Trim valuator investment valuation ability scope

Valuators shouldn't be able to valuate an investment which valuation has
already been finished (only admins can)
This commit is contained in:
Bertocq
2018-03-06 12:27:18 +01:00
parent a92ef57bf8
commit 1ef2789640
2 changed files with 8 additions and 1 deletions

View File

@@ -19,6 +19,12 @@ describe Abilities::Valuator do
it { should be_able_to(:update, SpendingProposal) }
it { should be_able_to(:valuate, SpendingProposal) }
it "cannot valuate an assigned investment with a finished valuation" do
assigned_investment.update(valuation_finished: true)
should_not be_able_to(:valuate, assigned_investment)
end
it { should_not be_able_to(:update, non_assigned_investment) }
it { should_not be_able_to(:valuate, non_assigned_investment) }