Remove unneeded factories
These factories were only used in one place and they even declared ID attributes. Using the comment factory with the `commentable` attribute does the same thing.
This commit is contained in:
@@ -184,29 +184,6 @@ LOREM_IPSUM
|
|||||||
author factory: :user
|
author factory: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :debate_comment, class: "Comment" do
|
|
||||||
commentable_id { "10" }
|
|
||||||
commentable_type { Legislation::Question }
|
|
||||||
body { "This is a comment" }
|
|
||||||
user_id { "1" }
|
|
||||||
cached_votes_down { "0" }
|
|
||||||
cached_votes_total { "0" }
|
|
||||||
cached_votes_up { "0" }
|
|
||||||
confidence_score { "0" }
|
|
||||||
end
|
|
||||||
|
|
||||||
factory :text_comment, class: "Comment" do
|
|
||||||
commentable_id { "10" }
|
|
||||||
commentable_type { Legislation::Annotation }
|
|
||||||
body { "This is a comment" }
|
|
||||||
user_id { "1" }
|
|
||||||
cached_votes_down { "0" }
|
|
||||||
cached_votes_total { "0" }
|
|
||||||
cached_votes_up { "0" }
|
|
||||||
confidence_score { "0" }
|
|
||||||
ancestry { nil }
|
|
||||||
end
|
|
||||||
|
|
||||||
factory :legislation_people_proposal, class: "Legislation::PeopleProposal" do
|
factory :legislation_people_proposal, class: "Legislation::PeopleProposal" do
|
||||||
sequence(:title) { |n| "People and group #{n} for a legislation" }
|
sequence(:title) { |n| "People and group #{n} for a legislation" }
|
||||||
summary { "This law should be implemented by..." }
|
summary { "This law should be implemented by..." }
|
||||||
|
|||||||
@@ -69,12 +69,13 @@ describe "Legislation" do
|
|||||||
before do
|
before do
|
||||||
user = create(:user, :level_two)
|
user = create(:user, :level_two)
|
||||||
@process = create(:legislation_process, end_date: Date.current - 1.day)
|
@process = create(:legislation_process, end_date: Date.current - 1.day)
|
||||||
|
|
||||||
@debate = create(:legislation_question, process: @process, title: "Question 1")
|
@debate = create(:legislation_question, process: @process, title: "Question 1")
|
||||||
create(:debate_comment, user: user, commentable_id: @debate.id, body: "Answer 1")
|
create(:comment, user: user, commentable: @debate, body: "Answer 1")
|
||||||
create(:debate_comment, user: user, commentable_id: @debate.id, body: "Answer 2")
|
create(:comment, user: user, commentable: @debate, body: "Answer 2")
|
||||||
@debate = create(:legislation_question, process: @process, title: "Question 2")
|
@debate = create(:legislation_question, process: @process, title: "Question 2")
|
||||||
create(:debate_comment, user: user, commentable_id: @debate.id, body: "Answer 3")
|
create(:comment, user: user, commentable: @debate, body: "Answer 3")
|
||||||
create(:debate_comment, user: user, commentable_id: @debate.id, body: "Answer 4")
|
create(:comment, user: user, commentable: @debate, body: "Answer 4")
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "show debates list" do
|
scenario "show debates list" do
|
||||||
@@ -187,10 +188,11 @@ describe "Legislation" do
|
|||||||
annotation2 = create(:legislation_annotation,
|
annotation2 = create(:legislation_annotation,
|
||||||
draft_version: draft_version_2,
|
draft_version: draft_version_2,
|
||||||
ranges: [{ "start" => "/p[1]", "startOffset" => 12, "end" => "/p[1]", "endOffset" => 19 }])
|
ranges: [{ "start" => "/p[1]", "startOffset" => 12, "end" => "/p[1]", "endOffset" => 19 }])
|
||||||
create(:text_comment, user: user, commentable_id: annotation0.id, body: "Comment 0")
|
|
||||||
create(:text_comment, user: user, commentable_id: annotation1.id, body: "Comment 1")
|
create(:comment, user: user, commentable: annotation0, body: "Comment 0")
|
||||||
create(:text_comment, user: user, commentable_id: annotation2.id, body: "Comment 2")
|
create(:comment, user: user, commentable: annotation1, body: "Comment 1")
|
||||||
create(:text_comment, user: user, commentable_id: annotation2.id, body: "Comment 3")
|
create(:comment, user: user, commentable: annotation2, body: "Comment 2")
|
||||||
|
create(:comment, user: user, commentable: annotation2, body: "Comment 3")
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "debates empty" do
|
scenario "debates empty" do
|
||||||
@@ -233,8 +235,8 @@ describe "Legislation" do
|
|||||||
user = create(:user, :level_two)
|
user = create(:user, :level_two)
|
||||||
@process = create(:legislation_process, end_date: Date.current - 1.day)
|
@process = create(:legislation_process, end_date: Date.current - 1.day)
|
||||||
@debate = create(:legislation_question, process: @process, title: "Question 1")
|
@debate = create(:legislation_question, process: @process, title: "Question 1")
|
||||||
create(:debate_comment, user: user, commentable_id: @debate.id, body: "Answer 1")
|
create(:comment, user: user, commentable: @debate, body: "Answer 1")
|
||||||
create(:debate_comment, user: user, commentable_id: @debate.id, body: "Answer 2")
|
create(:comment, user: user, commentable: @debate, body: "Answer 2")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "download execl file test" do
|
it "download execl file test" do
|
||||||
|
|||||||
Reference in New Issue
Block a user