diff --git a/spec/system/comments/budget_investments_spec.rb b/spec/system/comments/budget_investments_spec.rb index e3acb15e8..40b705768 100644 --- a/spec/system/comments/budget_investments_spec.rb +++ b/spec/system/comments/budget_investments_spec.rb @@ -6,34 +6,6 @@ describe "Commenting Budget::Investments" do it_behaves_like "flaggable", :budget_investment_comment - scenario "Creation date works differently in roots and child comments when sorting by confidence_score" do - old_root = create(:comment, commentable: investment, created_at: Time.current - 10) - new_root = create(:comment, commentable: investment, created_at: Time.current) - old_child = create(:comment, - commentable: investment, - parent_id: new_root.id, - created_at: Time.current - 10) - new_child = create(:comment, - commentable: investment, - parent_id: new_root.id, - created_at: Time.current) - - visit budget_investment_path(investment.budget, investment, order: :most_voted) - - expect(new_root.body).to appear_before(old_root.body) - expect(old_child.body).to appear_before(new_child.body) - - visit budget_investment_path(investment.budget, investment, order: :newest) - - expect(new_root.body).to appear_before(old_root.body) - expect(new_child.body).to appear_before(old_child.body) - - visit budget_investment_path(investment.budget, investment, order: :oldest) - - expect(old_root.body).to appear_before(new_root.body) - expect(old_child.body).to appear_before(new_child.body) - end - scenario "Turns links into html links" do create(:comment, commentable: investment, body: "Built with http://rubyonrails.org/") diff --git a/spec/system/comments/debates_spec.rb b/spec/system/comments/debates_spec.rb index 20ed63932..8597f66c9 100644 --- a/spec/system/comments/debates_spec.rb +++ b/spec/system/comments/debates_spec.rb @@ -25,28 +25,6 @@ describe "Commenting debates" do end end - scenario "Creation date works differently in roots and child comments when sorting by confidence_score" do - old_root = create(:comment, commentable: debate, created_at: Time.current - 10) - new_root = create(:comment, commentable: debate, created_at: Time.current) - old_child = create(:comment, commentable: debate, parent_id: new_root.id, created_at: Time.current - 10) - new_child = create(:comment, commentable: debate, parent_id: new_root.id, created_at: Time.current) - - visit debate_path(debate, order: :most_voted) - - expect(new_root.body).to appear_before(old_root.body) - expect(old_child.body).to appear_before(new_child.body) - - visit debate_path(debate, order: :newest) - - expect(new_root.body).to appear_before(old_root.body) - expect(new_child.body).to appear_before(old_child.body) - - visit debate_path(debate, order: :oldest) - - expect(old_root.body).to appear_before(new_root.body) - expect(old_child.body).to appear_before(new_child.body) - end - scenario "Turns links into html links" do create(:comment, commentable: debate, body: "Built with http://rubyonrails.org/") diff --git a/spec/system/comments/legislation_annotations_spec.rb b/spec/system/comments/legislation_annotations_spec.rb index d9b8ee291..068ff9b1a 100644 --- a/spec/system/comments/legislation_annotations_spec.rb +++ b/spec/system/comments/legislation_annotations_spec.rb @@ -6,34 +6,6 @@ describe "Commenting legislation questions" do it_behaves_like "flaggable", :legislation_annotation_comment - scenario "Creation date works differently in roots and child comments when sorting by confidence_score" do - old_root = create(:comment, commentable: annotation, created_at: Time.current - 10) - new_root = create(:comment, commentable: annotation, created_at: Time.current) - old_child = create(:comment, - commentable: annotation, - parent_id: new_root.id, - created_at: Time.current - 10) - new_child = create(:comment, - commentable: annotation, - parent_id: new_root.id, - created_at: Time.current) - - visit polymorphic_path(annotation, order: :most_voted) - - expect(new_root.body).to appear_before(old_root.body) - expect(old_child.body).to appear_before(new_child.body) - - visit polymorphic_path(annotation, order: :newest) - - expect(new_root.body).to appear_before(old_root.body) - expect(new_child.body).to appear_before(old_child.body) - - visit polymorphic_path(annotation, order: :oldest) - - expect(old_root.body).to appear_before(new_root.body) - expect(old_child.body).to appear_before(new_child.body) - end - scenario "Turns links into html links" do annotation = create(:legislation_annotation, author: user) annotation.comments << create(:comment, body: "Built with http://rubyonrails.org/") diff --git a/spec/system/comments/legislation_questions_spec.rb b/spec/system/comments/legislation_questions_spec.rb index 0cf4e2092..e12c8922d 100644 --- a/spec/system/comments/legislation_questions_spec.rb +++ b/spec/system/comments/legislation_questions_spec.rb @@ -10,28 +10,6 @@ describe "Commenting legislation questions" do it_behaves_like "flaggable", :legislation_question_comment end - scenario "Creation date works differently in roots and child comments when sorting by confidence_score" do - old_root = create(:comment, commentable: question, created_at: Time.current - 10) - new_root = create(:comment, commentable: question, created_at: Time.current) - old_child = create(:comment, commentable: question, parent_id: new_root.id, created_at: Time.current - 10) - new_child = create(:comment, commentable: question, parent_id: new_root.id, created_at: Time.current) - - visit legislation_process_question_path(question.process, question, order: :most_voted) - - expect(new_root.body).to appear_before(old_root.body) - expect(old_child.body).to appear_before(new_child.body) - - visit legislation_process_question_path(question.process, question, order: :newest) - - expect(new_root.body).to appear_before(old_root.body) - expect(new_child.body).to appear_before(old_child.body) - - visit legislation_process_question_path(question.process, question, order: :oldest) - - expect(old_root.body).to appear_before(new_root.body) - expect(old_child.body).to appear_before(new_child.body) - end - scenario "Turns links into html links" do create(:comment, commentable: question, body: "Built with http://rubyonrails.org/") diff --git a/spec/system/comments/polls_spec.rb b/spec/system/comments/polls_spec.rb index eba39ac94..29501d5c3 100644 --- a/spec/system/comments/polls_spec.rb +++ b/spec/system/comments/polls_spec.rb @@ -4,28 +4,6 @@ describe "Commenting polls" do let(:user) { create(:user) } let(:poll) { create(:poll, author: create(:user)) } - scenario "Creation date works differently in roots and child comments when sorting by confidence_score" do - old_root = create(:comment, commentable: poll, created_at: Time.current - 10) - new_root = create(:comment, commentable: poll, created_at: Time.current) - old_child = create(:comment, commentable: poll, parent_id: new_root.id, created_at: Time.current - 10) - new_child = create(:comment, commentable: poll, parent_id: new_root.id, created_at: Time.current) - - visit poll_path(poll, order: :most_voted) - - expect(new_root.body).to appear_before(old_root.body) - expect(old_child.body).to appear_before(new_child.body) - - visit poll_path(poll, order: :newest) - - expect(new_root.body).to appear_before(old_root.body) - expect(new_child.body).to appear_before(old_child.body) - - visit poll_path(poll, order: :oldest) - - expect(old_root.body).to appear_before(new_root.body) - expect(old_child.body).to appear_before(new_child.body) - end - scenario "Turns links into html links" do create(:comment, commentable: poll, body: "Built with http://rubyonrails.org/") diff --git a/spec/system/comments/proposals_spec.rb b/spec/system/comments/proposals_spec.rb index adf1e6577..d0dad7f06 100644 --- a/spec/system/comments/proposals_spec.rb +++ b/spec/system/comments/proposals_spec.rb @@ -6,28 +6,6 @@ describe "Commenting proposals" do it_behaves_like "flaggable", :proposal_comment - scenario "Creation date works differently in roots and child comments when sorting by confidence_score" do - old_root = create(:comment, commentable: proposal, created_at: Time.current - 10) - new_root = create(:comment, commentable: proposal, created_at: Time.current) - old_child = create(:comment, commentable: proposal, parent_id: new_root.id, created_at: Time.current - 10) - new_child = create(:comment, commentable: proposal, parent_id: new_root.id, created_at: Time.current) - - visit proposal_path(proposal, order: :most_voted) - - expect(new_root.body).to appear_before(old_root.body) - expect(old_child.body).to appear_before(new_child.body) - - visit proposal_path(proposal, order: :newest) - - expect(new_root.body).to appear_before(old_root.body) - expect(new_child.body).to appear_before(old_child.body) - - visit proposal_path(proposal, order: :oldest) - - expect(old_root.body).to appear_before(new_root.body) - expect(old_child.body).to appear_before(new_child.body) - end - scenario "Turns links into html links" do create(:comment, commentable: proposal, body: "Built with http://rubyonrails.org/") diff --git a/spec/system/comments/topics_spec.rb b/spec/system/comments/topics_spec.rb index 0da477807..19f5ecbd1 100644 --- a/spec/system/comments/topics_spec.rb +++ b/spec/system/comments/topics_spec.rb @@ -6,30 +6,6 @@ describe "Commenting topics from proposals" do it_behaves_like "flaggable", :topic_with_community_comment - scenario "Creation date works differently in roots and child comments when sorting by confidence_score" do - community = proposal.community - topic = create(:topic, community: community) - old_root = create(:comment, commentable: topic, created_at: Time.current - 10) - new_root = create(:comment, commentable: topic, created_at: Time.current) - old_child = create(:comment, commentable: topic, parent_id: new_root.id, created_at: Time.current - 10) - new_child = create(:comment, commentable: topic, parent_id: new_root.id, created_at: Time.current) - - visit community_topic_path(community, topic, order: :most_voted) - - expect(new_root.body).to appear_before(old_root.body) - expect(old_child.body).to appear_before(new_child.body) - - visit community_topic_path(community, topic, order: :newest) - - expect(new_root.body).to appear_before(old_root.body) - expect(new_child.body).to appear_before(old_child.body) - - visit community_topic_path(community, topic, order: :oldest) - - expect(old_root.body).to appear_before(new_root.body) - expect(old_child.body).to appear_before(new_child.body) - end - scenario "Turns links into html links" do community = proposal.community topic = create(:topic, community: community) @@ -429,30 +405,6 @@ describe "Commenting topics from budget investments" do let(:user) { create(:user) } let(:investment) { create(:budget_investment) } - scenario "Creation date works differently in roots and child comments when sorting by confidence_score" do - community = investment.community - topic = create(:topic, community: community) - old_root = create(:comment, commentable: topic, created_at: Time.current - 10) - new_root = create(:comment, commentable: topic, created_at: Time.current) - old_child = create(:comment, commentable: topic, parent_id: new_root.id, created_at: Time.current - 10) - new_child = create(:comment, commentable: topic, parent_id: new_root.id, created_at: Time.current) - - visit community_topic_path(community, topic, order: :most_voted) - - expect(new_root.body).to appear_before(old_root.body) - expect(old_child.body).to appear_before(new_child.body) - - visit community_topic_path(community, topic, order: :newest) - - expect(new_root.body).to appear_before(old_root.body) - expect(new_child.body).to appear_before(old_child.body) - - visit community_topic_path(community, topic, order: :oldest) - - expect(old_root.body).to appear_before(new_root.body) - expect(old_child.body).to appear_before(new_child.body) - end - scenario "Turns links into html links" do community = investment.community topic = create(:topic, community: community) diff --git a/spec/system/comments_spec.rb b/spec/system/comments_spec.rb index 79d0775e0..5f822f34a 100644 --- a/spec/system/comments_spec.rb +++ b/spec/system/comments_spec.rb @@ -205,6 +205,31 @@ describe "Comments" do expect(c2.body).to appear_before(c3.body) end + scenario "Creation date works differently in roots and child comments when sorting by confidence_score" do + old_root = create(:comment, commentable: resource, created_at: Time.current - 10) + new_root = create(:comment, commentable: resource, created_at: Time.current) + old_child = create(:comment, + commentable: resource, + parent_id: new_root.id, + created_at: Time.current - 10) + new_child = create(:comment, commentable: resource, parent_id: new_root.id, created_at: Time.current) + + visit polymorphic_path(resource, order: :most_voted) + + expect(new_root.body).to appear_before(old_root.body) + expect(old_child.body).to appear_before(new_child.body) + + visit polymorphic_path(resource, order: :newest) + + expect(new_root.body).to appear_before(old_root.body) + expect(new_child.body).to appear_before(old_child.body) + + visit polymorphic_path(resource, order: :oldest) + + expect(old_root.body).to appear_before(new_root.body) + expect(old_child.body).to appear_before(new_child.body) + end + scenario "Errors on create" do login_as(user) visit polymorphic_path(resource)