<commit_before>require 'rails_helper'

describe 'Comment features' do
	context "on new comment page" do
		let(:query) { FactoryGirl.create(:query) }
		it "can see a form to write a new comment" do
			stub_authorize_user!
			visit new_query_comment_path(query)
			expect(page).to have_text("Content")
		end

		it "can see a form with button 'add comment'" do
			stub_authorize_user!
			visit new_query_comment_path(query)
			expect(page).to have_button("add comment")
		end

		it "can create a comment with form" do #BUGBUG
			stub_authorize_user!
			visit new_query_comment_path(query)
			expect {
				fill_in 'Content', with: 'Here is my comment!'
				click_button 'add comment'
			}.to change{Comment.count}.by(1) <commit_msg>Test for view creation of comment with form works<commit_after>require 'rails_helper'

describe 'Comment features' do

	context "on new comment page" do

		let!(:language) {FactoryGirl.create(:language)}
		let!(:query) { FactoryGirl.create(:query, :language => language) }

		it "can see a form to write a new comment" do
			stub_authorize_user!
			visit new_query_comment_path(query)
			expect(page).to have_text("Content")
		end

		it "can see a form with button 'add comment'" do
			stub_authorize_user!
			visit new_query_comment_path(query)
			expect(page).to have_button("add comment")
		end

		it "can create a comment with form" do #BUGBUG
			stub_authorize_user!
			p query
			expect{ 
				visit new_query_comment_path(query)
				fill_in 'Content', with: 'Here is my comment!'
				click_button 'add comment' 
				}.to change{Comment.count}.by(1) 
{'fraction_non_alphanumeric': 0.09538850284270373, 'fraction_numerical': 0.0012634238787113076, 'mean_word_length': 4.28, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2463729', 'n_tokens_mistral': 588, 'n_tokens_neox': 512, 'n_words': 160}