Merge pull request #1347 from consul/budgets-vote-button
only displays vote button in selecting phase
This commit is contained in:
@@ -199,7 +199,7 @@ class Budget
|
||||
end
|
||||
|
||||
def should_show_votes?
|
||||
budget.selecting? || budget.on_hold?
|
||||
budget.selecting?
|
||||
end
|
||||
|
||||
def should_show_ballots?
|
||||
|
||||
@@ -94,15 +94,13 @@ feature 'Votes' do
|
||||
visit budget_investments_path(budget, heading_id: heading.id)
|
||||
|
||||
within("#budget_investment_#{investment.id}") do
|
||||
find("div.js-participation").hover
|
||||
expect(page).to have_content 'No Selecting Allowed'
|
||||
expect(page).to_not have_css("budget_investment_#{investment.id}_votes")
|
||||
end
|
||||
|
||||
visit budget_investment_path(budget, investment)
|
||||
|
||||
within("#budget_investment_#{investment.id}") do
|
||||
find("div.js-participation").hover
|
||||
expect(page).to have_content 'No Selecting Allowed'
|
||||
expect(page).to_not have_css("budget_investment_#{investment.id}_votes")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user