Add abilities to documentable authors and admins to create and destroy documents.

This commit is contained in:
Senén Rodero Rodríguez
2017-07-21 11:55:15 +02:00
parent 34d06dad04
commit c92827e89e
4 changed files with 36 additions and 0 deletions

View File

@@ -12,8 +12,12 @@ describe "Abilities::Administrator" do
let(:debate) { create(:debate) }
let(:comment) { create(:comment) }
let(:proposal) { create(:proposal) }
let(:budget_investment) { create(:budget_investment) }
let(:legislation_question) { create(:legislation_question) }
let(:proposal_document) { build(:document, documentable: proposal) }
let(:budget_investment_document) { build(:document, documentable: budget_investment) }
let(:hidden_debate) { create(:debate, :hidden) }
let(:hidden_comment) { create(:comment, :hidden) }
let(:hidden_proposal) { create(:proposal, :hidden) }
@@ -71,4 +75,12 @@ describe "Abilities::Administrator" do
it { should be_able_to(:valuate, create(:budget_investment, budget: create(:budget, phase: 'valuating'))) }
it { should be_able_to(:valuate, create(:budget_investment, budget: create(:budget, phase: 'finished'))) }
it { should be_able_to(:new, proposal_document) }
it { should be_able_to(:create, proposal_document) }
it { should be_able_to(:destroy, proposal_document) }
it { should be_able_to(:new, budget_investment_document) }
it { should be_able_to(:create, budget_investment_document) }
it { should be_able_to(:destroy, budget_investment_document) }
end