adds admin permissions for investments

This commit is contained in:
kikito
2016-05-30 14:13:36 +02:00
parent 2a82e9e33a
commit 7005faabe6
2 changed files with 18 additions and 2 deletions

View File

@@ -4,7 +4,6 @@ module Abilities
def initialize(user)
self.merge Abilities::Moderation.new(user)
self.merge Abilities::Valuator.new(user)
can :restore, Comment
cannot :restore, Comment, hidden_at: nil
@@ -41,7 +40,12 @@ module Abilities
can :manage, Annotation
can [:read, :update, :destroy, :summary], SpendingProposal
can [:read, :update, :valuate, :destroy, :summary], SpendingProposal
can [:create, :update], Budget
can [:hide, :update], Budget::Investment
can :valuate, Budget::Investment, budget: { valuating: true }
can :create, Budget::ValuatorAssignment
end
end
end

View File

@@ -56,4 +56,16 @@ describe "Abilities::Administrator" do
it { should be_able_to(:update, SpendingProposal) }
it { should be_able_to(:valuate, SpendingProposal) }
it { should be_able_to(:destroy, SpendingProposal) }
it { should be_able_to(:create, Budget) }
it { should be_able_to(:update, Budget) }
it { should be_able_to(:create, Budget::ValuatorAssignment) }
it { should be_able_to(:update, Budget::Investment) }
it { should be_able_to(:hide, Budget::Investment) }
it { should be_able_to(:valuate, create(:budget_investment, budget: create(:budget, valuating: true))) }
it { should_not be_able_to(:valuate, create(:budget_investment, budget: create(:budget, valuating: false))) }
end