Simplify creating voters in specs
This commit is contained in:
@@ -789,11 +789,8 @@ describe "Budget Investments" do
|
||||
|
||||
per_page.times { create(:budget_investment, heading: heading) }
|
||||
|
||||
voted_investments = []
|
||||
per_page.times do
|
||||
investment = create(:budget_investment, heading: heading)
|
||||
create(:vote, votable: investment, voter: voter)
|
||||
voted_investments << investment
|
||||
voted_investments = Array.new(per_page) do
|
||||
create(:budget_investment, heading: heading, voters: [voter])
|
||||
end
|
||||
|
||||
login_as(voter)
|
||||
@@ -1354,11 +1351,9 @@ describe "Budget Investments" do
|
||||
carabanchel = create(:budget_heading, group: group)
|
||||
salamanca = create(:budget_heading, group: group)
|
||||
|
||||
carabanchel_investment = create(:budget_investment, heading: carabanchel)
|
||||
carabanchel_investment = create(:budget_investment, heading: carabanchel, voters: [author])
|
||||
salamanca_investment = create(:budget_investment, heading: salamanca)
|
||||
|
||||
create(:vote, votable: carabanchel_investment, voter: author)
|
||||
|
||||
login_as(author)
|
||||
visit budget_investments_path(budget, heading_id: carabanchel.id)
|
||||
|
||||
@@ -1374,11 +1369,9 @@ describe "Budget Investments" do
|
||||
another_heading1 = create(:budget_heading, group: group2)
|
||||
another_heading2 = create(:budget_heading, group: group2)
|
||||
|
||||
heading_investment = create(:budget_investment, heading: heading)
|
||||
heading_investment = create(:budget_investment, heading: heading, voters: [author])
|
||||
another_group_investment = create(:budget_investment, heading: another_heading1)
|
||||
|
||||
create(:vote, votable: heading_investment, voter: author)
|
||||
|
||||
login_as(author)
|
||||
visit budget_investments_path(budget, heading_id: another_heading1.id)
|
||||
|
||||
@@ -1417,8 +1410,7 @@ describe "Budget Investments" do
|
||||
end
|
||||
|
||||
scenario "Sidebar in show should display support text and count" do
|
||||
investment = create(:budget_investment, :selected, budget: budget)
|
||||
create(:vote, votable: investment)
|
||||
investment = create(:budget_investment, :selected, budget: budget, voters: [create(:user)])
|
||||
|
||||
visit budget_investment_path(budget, investment)
|
||||
|
||||
@@ -1429,8 +1421,7 @@ describe "Budget Investments" do
|
||||
end
|
||||
|
||||
scenario "Index should display support count" do
|
||||
investment = create(:budget_investment, budget: budget, heading: heading)
|
||||
create(:vote, votable: investment)
|
||||
investment = create(:budget_investment, budget: budget, heading: heading, voters: [create(:user)])
|
||||
|
||||
visit budget_investments_path(budget, heading_id: heading.id)
|
||||
|
||||
@@ -1440,8 +1431,7 @@ describe "Budget Investments" do
|
||||
end
|
||||
|
||||
scenario "Show should display support text and count" do
|
||||
investment = create(:budget_investment, budget: budget, heading: heading)
|
||||
create(:vote, votable: investment)
|
||||
investment = create(:budget_investment, budget: budget, heading: heading, voters: [create(:user)])
|
||||
|
||||
visit budget_investment_path(budget, investment)
|
||||
|
||||
|
||||
@@ -13,10 +13,9 @@ describe "Votes" do
|
||||
describe "Index" do
|
||||
|
||||
scenario "Index shows user votes on proposals" do
|
||||
investment1 = create(:budget_investment, heading: heading)
|
||||
investment1 = create(:budget_investment, heading: heading, voters: [manuela])
|
||||
investment2 = create(:budget_investment, heading: heading)
|
||||
investment3 = create(:budget_investment, heading: heading)
|
||||
create(:vote, voter: manuela, votable: investment1, vote_flag: true)
|
||||
|
||||
visit budget_investments_path(budget, heading_id: heading.id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user