allows user to support only in one heading per group

This commit is contained in:
rgarcia
2017-01-13 15:24:57 +01:00
parent a771408f4b
commit b2b9954e6d
8 changed files with 102 additions and 2 deletions

View File

@@ -236,6 +236,18 @@ describe Budget::Investment do
budget.phase = "selecting"
expect(district_sp.reason_for_not_being_selectable_by(user)).to be_nil
end
it "rejects votes in two headings of the same group" do
carabanchel = create(:budget_heading, group: group)
salamanca = create(:budget_heading, group: group)
carabanchel_investment = create(:budget_investment, heading: carabanchel)
salamanca_investment = create(:budget_investment, heading: salamanca)
create(:vote, votable: carabanchel_investment, voter: user)
expect(salamanca_investment.valid_heading?(user)).to eq(false)
end
end
end