Add unfinished trait to investment factories

Now the code is symmetrical since we also use `finished`.
This commit is contained in:
Javi Martín
2019-09-21 14:59:26 +02:00
parent 53fa527118
commit 24e8f07dae
4 changed files with 7 additions and 6 deletions

View File

@@ -114,6 +114,10 @@ FactoryBot.define do
valuation_finished { true }
end
trait :unfinished do
valuation_finished { false }
end
trait :selected do
selected { true }
feasibility { "feasible" }

View File

@@ -346,7 +346,7 @@ describe "Admin budget investments" do
valuator = create(:valuator, user: user)
create(:budget_investment,
:with_administrator,
valuation_finished: false,
:unfinished,
title: "Investment without valuation",
budget: budget,
valuators: [valuator])

View File

@@ -1263,7 +1263,7 @@ describe "Budget Investments" do
investment = create(:budget_investment,
:unfeasible,
valuation_finished: false,
:unfinished,
budget: budget,
group: group,
heading: heading,

View File

@@ -1228,10 +1228,7 @@ describe Budget::Investment do
let(:params) { { advanced_filters: ["under_valuation"], budget_id: budget.id } }
it "returns only investment under valuation" do
valuator1 = create(:valuator)
investment1 = create(:budget_investment,
:with_administrator,
valuation_finished: false,
budget: budget)
investment1 = create(:budget_investment, :with_administrator, :unfinished, budget: budget)
investment1.valuators << valuator1
create(:budget_investment, :with_administrator, budget: budget)
create(:budget_investment, budget: budget)