Adds common Investment abilities
This commit is contained in:
@@ -19,6 +19,7 @@ module Abilities
|
||||
can [:retire_form, :retire], Proposal, author_id: user.id
|
||||
|
||||
can :read, SpendingProposal
|
||||
can :read, Budget::Investment
|
||||
|
||||
can :create, Comment
|
||||
can :create, Debate
|
||||
@@ -46,6 +47,9 @@ module Abilities
|
||||
can :vote_featured, Proposal
|
||||
can :vote, SpendingProposal
|
||||
can :create, SpendingProposal
|
||||
can :create, Budget::Investment, budget: { phase: "accepting" }
|
||||
can :vote, Budget::Investment, budget: { phase: "selecting" }
|
||||
can :ballot, Budget::Investment, budget: { phase: "balloting" }
|
||||
end
|
||||
|
||||
can :create, Annotation
|
||||
|
||||
@@ -9,6 +9,9 @@ describe "Abilities::Common" do
|
||||
let(:debate) { create(:debate) }
|
||||
let(:comment) { create(:comment) }
|
||||
let(:proposal) { create(:proposal) }
|
||||
let(:investment_in_accepting_budget) { create(:budget_investment, budget: create(:budget, phase: 'accepting')) }
|
||||
let(:investment_in_selecting_budget) { create(:budget_investment, budget: create(:budget, phase: 'selecting')) }
|
||||
let(:investment_in_balloting_budget) { create(:budget_investment, budget: create(:budget, phase: 'balloting')) }
|
||||
let(:own_debate) { create(:debate, author: user) }
|
||||
let(:own_comment) { create(:comment, author: user) }
|
||||
let(:own_proposal) { create(:proposal, author: user) }
|
||||
@@ -93,6 +96,19 @@ describe "Abilities::Common" do
|
||||
it { should be_able_to(:create, SpendingProposal) }
|
||||
it { should_not be_able_to(:destroy, create(:spending_proposal)) }
|
||||
it { should_not be_able_to(:destroy, own_spending_proposal) }
|
||||
|
||||
it { should be_able_to(:create, investment_in_accepting_budget) }
|
||||
it { should_not be_able_to(:create, investment_in_selecting_budget) }
|
||||
it { should_not be_able_to(:create, investment_in_balloting_budget) }
|
||||
|
||||
it { should_not be_able_to(:vote, investment_in_accepting_budget) }
|
||||
it { should be_able_to(:vote, investment_in_selecting_budget) }
|
||||
it { should_not be_able_to(:vote, investment_in_balloting_budget) }
|
||||
|
||||
it { should_not be_able_to(:ballot, investment_in_accepting_budget) }
|
||||
it { should_not be_able_to(:ballot, investment_in_selecting_budget) }
|
||||
it { should be_able_to(:ballot, investment_in_balloting_budget) }
|
||||
|
||||
end
|
||||
|
||||
describe "when level 3 verified" do
|
||||
|
||||
Reference in New Issue
Block a user