adds missing method specs

This commit is contained in:
Juanjo Bazán
2017-04-17 13:17:01 +02:00
parent 61e5c187da
commit 3f04854626

View File

@@ -144,6 +144,42 @@ describe Budget::Investment do
end
end
describe "#should_show_vote_count?" do
it "returns true in valuating phase" do
budget = create(:budget, phase: "valuating")
investment = create(:budget_investment, budget: budget)
expect(investment.should_show_vote_count?).to eq(true)
end
it "returns false in any other phase" do
Budget::PHASES.reject {|phase| phase == "valuating"}.each do |phase|
budget = create(:budget, phase: phase)
investment = create(:budget_investment, budget: budget)
expect(investment.should_show_vote_count?).to eq(false)
end
end
end
describe "#should_show_ballots?" do
it "returns true in balloting phase" do
budget = create(:budget, phase: "balloting")
investment = create(:budget_investment, budget: budget)
expect(investment.should_show_ballots?).to eq(true)
end
it "returns false in any other phase" do
Budget::PHASES.reject {|phase| phase == "balloting"}.each do |phase|
budget = create(:budget, phase: phase)
investment = create(:budget_investment, budget: budget)
expect(investment.should_show_ballots?).to eq(false)
end
end
end
describe "#should_show_price_info?" do
it "returns true for feasibles if phase is balloting or later and price_explanation is present" do
["balloting", "reviewing_ballots", "finished"].each do |phase|