Splits ability.rb and specs into several smaller files

I'm doing this in preparation for the "Manager" ability, which will
require even more refactors of the abilities (for example,
manager can not modify their own account)
This commit is contained in:
kikito
2015-09-28 13:51:42 +02:00
parent dce6668af3
commit 82af488ce3
12 changed files with 456 additions and 379 deletions

View File

@@ -0,0 +1,24 @@
require 'rails_helper'
require 'cancan/matchers'
describe "Abilities::Organization" do
subject(:ability) { Ability.new(user) }
let(:user) { organization.user }
let(:organization) { create(:organization) }
let(:debate) { create(:debate) }
let(:proposal) { create(:proposal) }
it { should be_able_to(:show, user) }
it { should be_able_to(:edit, user) }
it { should be_able_to(:index, Debate) }
it { should be_able_to(:show, debate) }
it { should_not be_able_to(:vote, debate) }
it { should be_able_to(:index, Proposal) }
it { should be_able_to(:show, proposal) }
it { should_not be_able_to(:vote, Proposal) }
it { should be_able_to(:create, Comment) }
it { should_not be_able_to(:vote, Comment) }
end