Use feasibility traits to simplify code
This commit is contained in:
@@ -700,10 +700,8 @@ describe "Admin budget investments" do
|
||||
end
|
||||
|
||||
scenario "Combination of select with text search", :js do
|
||||
create(:budget_investment, :finished, budget: budget, title: "Educate the children",
|
||||
feasibility: "feasible")
|
||||
create(:budget_investment, :finished, budget: budget, title: "More schools",
|
||||
feasibility: "feasible")
|
||||
create(:budget_investment, :feasible, :finished, budget: budget, title: "Educate the children")
|
||||
create(:budget_investment, :feasible, :finished, budget: budget, title: "More schools")
|
||||
create(:budget_investment, budget: budget, title: "More hospitals")
|
||||
|
||||
visit admin_budget_budget_investments_path(budget_id: budget.id)
|
||||
@@ -740,11 +738,9 @@ describe "Admin budget investments" do
|
||||
user = create(:user, username: "Admin 1")
|
||||
administrator = create(:administrator, user: user)
|
||||
|
||||
create(:budget_investment, :finished, budget: budget, title: "Educate the children",
|
||||
feasibility: "feasible",
|
||||
create(:budget_investment, :feasible, :finished, budget: budget, title: "Educate the children",
|
||||
administrator: administrator)
|
||||
create(:budget_investment, :finished, budget: budget, title: "More schools",
|
||||
feasibility: "feasible",
|
||||
create(:budget_investment, :feasible, :finished, budget: budget, title: "More schools",
|
||||
administrator: administrator)
|
||||
create(:budget_investment, budget: budget, title: "More hospitals",
|
||||
administrator: administrator)
|
||||
@@ -984,10 +980,10 @@ describe "Admin budget investments" do
|
||||
user = create(:user, username: "Rachel", email: "rachel@valuators.org")
|
||||
valuator = create(:valuator, user: user)
|
||||
budget_investment = create(:budget_investment,
|
||||
:unfeasible,
|
||||
unfeasibility_explanation: "It is impossible",
|
||||
price: 1234,
|
||||
price_first_year: 1000,
|
||||
feasibility: "unfeasible",
|
||||
unfeasibility_explanation: "It is impossible",
|
||||
administrator: administrator)
|
||||
budget_investment.valuators << valuator
|
||||
|
||||
@@ -1015,10 +1011,10 @@ describe "Admin budget investments" do
|
||||
|
||||
scenario "Show image and documents on investment details" do
|
||||
budget_investment = create(:budget_investment,
|
||||
:unfeasible,
|
||||
unfeasibility_explanation: "It is impossible",
|
||||
price: 1234,
|
||||
price_first_year: 1000,
|
||||
feasibility: "unfeasible",
|
||||
unfeasibility_explanation: "It is impossible",
|
||||
administrator: administrator)
|
||||
create(:image, imageable: budget_investment)
|
||||
document = create(:document, documentable: budget_investment)
|
||||
@@ -1045,10 +1041,9 @@ describe "Admin budget investments" do
|
||||
|
||||
scenario "Not show related content or hide links on preview" do
|
||||
budget_investment = create(:budget_investment,
|
||||
:unfeasible,
|
||||
price: 1234,
|
||||
price_first_year: 1000,
|
||||
feasibility: "unfeasible",
|
||||
unfeasibility_explanation: "It is impossible",
|
||||
administrator: administrator)
|
||||
|
||||
visit admin_budget_budget_investments_path(budget_investment.budget)
|
||||
|
||||
@@ -15,10 +15,10 @@ describe "Admin change log" do
|
||||
|
||||
scenario "No changes" do
|
||||
budget_investment = create(:budget_investment,
|
||||
:unfeasible,
|
||||
unfeasibility_explanation: "It is impossible",
|
||||
price: 1234,
|
||||
price_first_year: 1000,
|
||||
feasibility: "unfeasible",
|
||||
unfeasibility_explanation: "It is impossible",
|
||||
administrator: administrator)
|
||||
|
||||
visit admin_budget_budget_investments_path(budget_investment.budget)
|
||||
@@ -34,10 +34,10 @@ describe "Admin change log" do
|
||||
|
||||
scenario "Changes" do
|
||||
budget_investment = create(:budget_investment,
|
||||
:unfeasible,
|
||||
unfeasibility_explanation: "It is impossible",
|
||||
price: 1234,
|
||||
price_first_year: 1000,
|
||||
feasibility: "unfeasible",
|
||||
unfeasibility_explanation: "It is impossible",
|
||||
administrator: administrator)
|
||||
|
||||
visit admin_budget_budget_investments_path(budget_investment.budget)
|
||||
|
||||
@@ -577,7 +577,7 @@ describe "Ballots" do
|
||||
end
|
||||
|
||||
scenario "Investments with feasibility undecided are not shown" do
|
||||
investment = create(:budget_investment, feasibility: "undecided", heading: new_york)
|
||||
investment = create(:budget_investment, :undecided, heading: new_york)
|
||||
|
||||
login_as(user)
|
||||
visit budget_path(budget)
|
||||
|
||||
@@ -241,7 +241,7 @@ describe "Valuation budget investments" do
|
||||
create(:valuator, user: create(:user, username: "Rick", email: "rick@valuators.org"))
|
||||
end
|
||||
let(:investment) do
|
||||
create(:budget_investment, budget: budget, price: 1234, feasibility: "unfeasible",
|
||||
create(:budget_investment, :unfeasible, budget: budget, price: 1234,
|
||||
unfeasibility_explanation: "It is impossible",
|
||||
administrator: administrator,)
|
||||
end
|
||||
|
||||
@@ -262,9 +262,7 @@ describe Budget::Investment do
|
||||
describe "#should_show_unfeasibility_explanation?" do
|
||||
let(:budget) { create(:budget) }
|
||||
let(:investment) do
|
||||
create(:budget_investment, :finished, budget: budget,
|
||||
unfeasibility_explanation: "because of reasons",
|
||||
feasibility: "unfeasible")
|
||||
create(:budget_investment, :unfeasible, :finished, budget: budget)
|
||||
end
|
||||
|
||||
it "returns true for unfeasible investments with unfeasibility explanation and valuation finished" do
|
||||
|
||||
Reference in New Issue
Block a user