Merge pull request #3685 from consul/less_records_in_tests

Create less headings in budget investment tests
This commit is contained in:
Javier Martín
2019-09-10 14:58:54 +02:00
committed by GitHub
2 changed files with 3 additions and 2 deletions

View File

@@ -83,7 +83,8 @@ FactoryBot.define do
factory :budget_investment, class: "Budget::Investment" do factory :budget_investment, class: "Budget::Investment" do
sequence(:title) { |n| "Budget Investment #{n} title" } sequence(:title) { |n| "Budget Investment #{n} title" }
heading { association :budget_heading, budget: budget } heading { budget&.headings&.reload&.sample || association(:budget_heading, budget: budget) }
association :author, factory: :user association :author, factory: :user
description { "Spend money on this" } description { "Spend money on this" }
price { 10 } price { 10 }

View File

@@ -87,7 +87,7 @@ describe Budget::Stats do
it "doesn't count nil user ids" do it "doesn't count nil user ids" do
create(:budget_ballot_line, investment: investment, create(:budget_ballot_line, investment: investment,
ballot: create(:budget_ballot, budget: budget, user: nil, physical: true) ballot: create(:budget_ballot, budget: budget.reload, user: nil, physical: true)
) )
expect(stats.total_participants_vote_phase).to be 0 expect(stats.total_participants_vote_phase).to be 0