Unify Creation date specs
This commit is contained in:
@@ -6,34 +6,6 @@ describe "Commenting Budget::Investments" do
|
|||||||
|
|
||||||
it_behaves_like "flaggable", :budget_investment_comment
|
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
|
scenario "Turns links into html links" do
|
||||||
create(:comment, commentable: investment, body: "Built with http://rubyonrails.org/")
|
create(:comment, commentable: investment, body: "Built with http://rubyonrails.org/")
|
||||||
|
|
||||||
|
|||||||
@@ -25,28 +25,6 @@ describe "Commenting debates" do
|
|||||||
end
|
end
|
||||||
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
|
scenario "Turns links into html links" do
|
||||||
create(:comment, commentable: debate, body: "Built with http://rubyonrails.org/")
|
create(:comment, commentable: debate, body: "Built with http://rubyonrails.org/")
|
||||||
|
|
||||||
|
|||||||
@@ -6,34 +6,6 @@ describe "Commenting legislation questions" do
|
|||||||
|
|
||||||
it_behaves_like "flaggable", :legislation_annotation_comment
|
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
|
scenario "Turns links into html links" do
|
||||||
annotation = create(:legislation_annotation, author: user)
|
annotation = create(:legislation_annotation, author: user)
|
||||||
annotation.comments << create(:comment, body: "Built with http://rubyonrails.org/")
|
annotation.comments << create(:comment, body: "Built with http://rubyonrails.org/")
|
||||||
|
|||||||
@@ -10,28 +10,6 @@ describe "Commenting legislation questions" do
|
|||||||
it_behaves_like "flaggable", :legislation_question_comment
|
it_behaves_like "flaggable", :legislation_question_comment
|
||||||
end
|
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
|
scenario "Turns links into html links" do
|
||||||
create(:comment, commentable: question, body: "Built with http://rubyonrails.org/")
|
create(:comment, commentable: question, body: "Built with http://rubyonrails.org/")
|
||||||
|
|
||||||
|
|||||||
@@ -4,28 +4,6 @@ describe "Commenting polls" do
|
|||||||
let(:user) { create(:user) }
|
let(:user) { create(:user) }
|
||||||
let(:poll) { create(:poll, author: 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
|
scenario "Turns links into html links" do
|
||||||
create(:comment, commentable: poll, body: "Built with http://rubyonrails.org/")
|
create(:comment, commentable: poll, body: "Built with http://rubyonrails.org/")
|
||||||
|
|
||||||
|
|||||||
@@ -6,28 +6,6 @@ describe "Commenting proposals" do
|
|||||||
|
|
||||||
it_behaves_like "flaggable", :proposal_comment
|
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
|
scenario "Turns links into html links" do
|
||||||
create(:comment, commentable: proposal, body: "Built with http://rubyonrails.org/")
|
create(:comment, commentable: proposal, body: "Built with http://rubyonrails.org/")
|
||||||
|
|
||||||
|
|||||||
@@ -6,30 +6,6 @@ describe "Commenting topics from proposals" do
|
|||||||
|
|
||||||
it_behaves_like "flaggable", :topic_with_community_comment
|
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
|
scenario "Turns links into html links" do
|
||||||
community = proposal.community
|
community = proposal.community
|
||||||
topic = create(:topic, community: community)
|
topic = create(:topic, community: community)
|
||||||
@@ -429,30 +405,6 @@ describe "Commenting topics from budget investments" do
|
|||||||
let(:user) { create(:user) }
|
let(:user) { create(:user) }
|
||||||
let(:investment) { create(:budget_investment) }
|
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
|
scenario "Turns links into html links" do
|
||||||
community = investment.community
|
community = investment.community
|
||||||
topic = create(:topic, community: community)
|
topic = create(:topic, community: community)
|
||||||
|
|||||||
@@ -205,6 +205,31 @@ describe "Comments" do
|
|||||||
expect(c2.body).to appear_before(c3.body)
|
expect(c2.body).to appear_before(c3.body)
|
||||||
end
|
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
|
scenario "Errors on create" do
|
||||||
login_as(user)
|
login_as(user)
|
||||||
visit polymorphic_path(resource)
|
visit polymorphic_path(resource)
|
||||||
|
|||||||
Reference in New Issue
Block a user