Add trait to create an investment with a valuator
This commit is contained in:
@@ -173,6 +173,10 @@ FactoryBot.define do
|
|||||||
administrator
|
administrator
|
||||||
end
|
end
|
||||||
|
|
||||||
|
trait :with_valuator do
|
||||||
|
valuators { [create(:valuator)] }
|
||||||
|
end
|
||||||
|
|
||||||
trait :flagged do
|
trait :flagged do
|
||||||
after :create do |investment|
|
after :create do |investment|
|
||||||
Flag.flag(create(:user), investment)
|
Flag.flag(create(:user), investment)
|
||||||
|
|||||||
@@ -447,8 +447,7 @@ describe "Admin budget investments" do
|
|||||||
|
|
||||||
scenario "Filtering by assignment status" do
|
scenario "Filtering by assignment status" do
|
||||||
create(:budget_investment, :with_administrator, title: "Assigned idea", budget: budget)
|
create(:budget_investment, :with_administrator, title: "Assigned idea", budget: budget)
|
||||||
create(:budget_investment, title: "Evaluating...", budget: budget,
|
create(:budget_investment, :with_valuator, title: "Evaluating...", budget: budget)
|
||||||
valuators: [create(:valuator)])
|
|
||||||
create(:budget_investment, title: "With group", budget: budget,
|
create(:budget_investment, title: "With group", budget: budget,
|
||||||
valuator_groups: [create(:valuator_group)])
|
valuator_groups: [create(:valuator_group)])
|
||||||
|
|
||||||
@@ -1652,10 +1651,10 @@ describe "Admin budget investments" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "Showing the valuating checkbox" do
|
scenario "Showing the valuating checkbox" do
|
||||||
investment1 = create(:budget_investment, :with_administrator, :visible_to_valuators,
|
investment1 = create(:budget_investment, :with_administrator, :with_valuator, :visible_to_valuators,
|
||||||
budget: budget, valuators: [create(:valuator)])
|
budget: budget)
|
||||||
investment2 = create(:budget_investment, :with_administrator, :invisible_to_valuators,
|
investment2 = create(:budget_investment, :with_administrator, :with_valuator, :invisible_to_valuators,
|
||||||
budget: budget, valuators: [create(:valuator), create(:valuator)])
|
budget: budget)
|
||||||
|
|
||||||
visit admin_budget_budget_investments_path(budget)
|
visit admin_budget_budget_investments_path(budget)
|
||||||
|
|
||||||
|
|||||||
@@ -416,7 +416,7 @@ describe Budget::Investment do
|
|||||||
|
|
||||||
describe "managed" do
|
describe "managed" do
|
||||||
it "returns all open investments with assigned admin but without assigned valuators" do
|
it "returns all open investments with assigned admin but without assigned valuators" do
|
||||||
investment1 = create(:budget_investment, :with_administrator, valuators: [create(:valuator)])
|
investment1 = create(:budget_investment, :with_administrator, :with_valuator)
|
||||||
investment2 = create(:budget_investment, :with_administrator, :finished)
|
investment2 = create(:budget_investment, :with_administrator, :finished)
|
||||||
investment3 = create(:budget_investment, :with_administrator)
|
investment3 = create(:budget_investment, :with_administrator)
|
||||||
|
|
||||||
@@ -429,8 +429,8 @@ describe Budget::Investment do
|
|||||||
describe "valuating" do
|
describe "valuating" do
|
||||||
it "returns all investments with assigned valuator but valuation not finished" do
|
it "returns all investments with assigned valuator but valuation not finished" do
|
||||||
investment1 = create(:budget_investment)
|
investment1 = create(:budget_investment)
|
||||||
investment2 = create(:budget_investment, valuators: [create(:valuator)])
|
investment2 = create(:budget_investment, :with_valuator)
|
||||||
investment3 = create(:budget_investment, :finished, valuators: [create(:valuator)])
|
investment3 = create(:budget_investment, :with_valuator, :finished)
|
||||||
|
|
||||||
valuating = Budget::Investment.valuating
|
valuating = Budget::Investment.valuating
|
||||||
|
|
||||||
@@ -454,8 +454,8 @@ describe Budget::Investment do
|
|||||||
describe "valuation_finished" do
|
describe "valuation_finished" do
|
||||||
it "returns all investments with valuation finished" do
|
it "returns all investments with valuation finished" do
|
||||||
investment1 = create(:budget_investment)
|
investment1 = create(:budget_investment)
|
||||||
investment2 = create(:budget_investment, valuators: [create(:valuator)])
|
investment2 = create(:budget_investment, :with_valuator)
|
||||||
investment3 = create(:budget_investment, :finished, valuators: [create(:valuator)])
|
investment3 = create(:budget_investment, :with_valuator, :finished)
|
||||||
|
|
||||||
valuation_finished = Budget::Investment.valuation_finished
|
valuation_finished = Budget::Investment.valuation_finished
|
||||||
|
|
||||||
@@ -1155,8 +1155,8 @@ describe Budget::Investment do
|
|||||||
describe "with under_valuation filter" do
|
describe "with under_valuation filter" do
|
||||||
let(:params) { { advanced_filters: ["under_valuation"], budget_id: budget.id } }
|
let(:params) { { advanced_filters: ["under_valuation"], budget_id: budget.id } }
|
||||||
it "returns only investment under valuation" do
|
it "returns only investment under valuation" do
|
||||||
investment1 = create(:budget_investment, :with_administrator, :unfinished,
|
investment1 = create(:budget_investment, :with_administrator, :unfinished, :with_valuator,
|
||||||
budget: budget, valuators: [create(:valuator)])
|
budget: budget)
|
||||||
create(:budget_investment, :with_administrator, budget: budget)
|
create(:budget_investment, :with_administrator, budget: budget)
|
||||||
create(:budget_investment, budget: budget)
|
create(:budget_investment, budget: budget)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user