only displays vote button in selecting phase

This commit is contained in:
rgarcia
2017-01-13 11:13:01 +01:00
parent 6952e7eac6
commit 470fe41585
2 changed files with 19 additions and 1 deletions

View File

@@ -199,7 +199,7 @@ class Budget
end
def should_show_votes?
budget.selecting? || budget.on_hold?
budget.selecting?
end
def should_show_ballots?

View File

@@ -65,6 +65,24 @@ describe Budget::Investment do
end
end
describe "#should_show_votes?" do
it "returns true in selecting phase" do
budget = create(:budget, phase: "selecting")
investment = create(:budget_investment, budget: budget)
expect(investment.should_show_votes?).to eq(true)
end
it "returns false in any other phase" do
Budget::PHASES.reject {|phase| phase == "selecting"}.each do |phase|
budget = create(:budget, phase: phase)
investment = create(:budget_investment, budget: budget)
expect(investment.should_show_votes?).to eq(false)
end
end
end
describe "by_admin" do
it "should return investments assigned to specific administrator" do
investment1 = create(:budget_investment, administrator_id: 33)