Files
nairobi/spec/models/abilities/organization_spec.rb
taitus 9fe24aec9d Add sdg manager section to admin
Allow a user to become an sdg manager
2020-12-16 13:16:45 +01:00

33 lines
997 B
Ruby

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) }
it { should_not be_able_to(:read, SDG::Goal) }
it { should_not be_able_to(:read, SDG::Target) }
it { should_not be_able_to(:read, SDG::Manager) }
it { should_not be_able_to(:create, SDG::Manager) }
it { should_not be_able_to(:delete, SDG::Manager) }
end