fixes issues with valuating in specs
This commit is contained in:
@@ -46,7 +46,7 @@ module Abilities
|
||||
can [:read, :create, :update, :destroy], Budget::Group
|
||||
can [:read, :create, :update, :destroy], Budget::Heading
|
||||
can [:hide, :update, :toggle_selection], Budget::Investment
|
||||
can :valuate, Budget::Investment, budget: { valuating: true }
|
||||
can :valuate, Budget::Investment, budget: { phase: 'valuating' }
|
||||
can :create, Budget::ValuatorAssignment
|
||||
|
||||
can [:search, :edit, :update, :create, :index, :destroy], Banner
|
||||
|
||||
@@ -5,7 +5,7 @@ module Abilities
|
||||
def initialize(user)
|
||||
valuator = user.valuator
|
||||
can [:read, :update, :valuate], SpendingProposal
|
||||
can [:read, :update, :valuate], Budget::Investment, id: valuator.investment_ids, budget: { valuating: true }
|
||||
can [:read, :update, :valuate], Budget::Investment, id: valuator.investment_ids, budget: { phase: 'valuating' }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -65,7 +65,7 @@ describe "Abilities::Administrator" do
|
||||
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))) }
|
||||
it { should be_able_to(:valuate, create(:budget_investment, budget: create(:budget, phase: 'valuating'))) }
|
||||
it { should_not be_able_to(:valuate, create(:budget_investment, budget: create(:budget, phase: 'finished'))) }
|
||||
|
||||
end
|
||||
|
||||
@@ -7,10 +7,10 @@ describe "Abilities::Valuator" do
|
||||
let(:valuator) { create(:valuator) }
|
||||
let(:non_assigned_investment) { create(:budget_investment) }
|
||||
|
||||
let(:assigned_investment) { create(:budget_investment, budget: create(:budget, valuating: true)) }
|
||||
let(:assigned_investment) { create(:budget_investment, budget: create(:budget, phase: 'valuating')) }
|
||||
before(:each) { assigned_investment.valuators << valuator }
|
||||
|
||||
let(:assigned_investment_not_valuating) { create(:budget_investment, budget: create(:budget, valuating: false)) }
|
||||
let(:assigned_investment_not_valuating) { create(:budget_investment, budget: create(:budget, phase: 'finished')) }
|
||||
before(:each) { assigned_investment_not_valuating.valuators << valuator }
|
||||
|
||||
it { should be_able_to(:read, SpendingProposal) }
|
||||
|
||||
Reference in New Issue
Block a user