Add cancancan to SDG content
Only allow access to the SDG content section to administrators and sdg managers
This commit is contained in:
@@ -106,4 +106,7 @@ describe Abilities::Administrator do
|
||||
it { should be_able_to(:manage, LocalCensusRecord) }
|
||||
it { should be_able_to(:create, LocalCensusRecords::Import) }
|
||||
it { should be_able_to(:show, LocalCensusRecords::Import) }
|
||||
|
||||
it { should be_able_to(:read, SDG::Goal) }
|
||||
it { should be_able_to(:read, SDG::Target) }
|
||||
end
|
||||
|
||||
@@ -304,4 +304,7 @@ describe Abilities::Common do
|
||||
it { should be_able_to(:disable_recommendations, Debate) }
|
||||
it { should be_able_to(:disable_recommendations, Proposal) }
|
||||
end
|
||||
|
||||
it { should_not be_able_to(:read, SDG::Goal) }
|
||||
it { should_not be_able_to(:read, SDG::Target) }
|
||||
end
|
||||
|
||||
@@ -52,4 +52,7 @@ describe Abilities::Everyone do
|
||||
it { should be_able_to(:summary, create(:legislation_process, :past)) }
|
||||
it { should_not be_able_to(:summary, create(:legislation_process, :open)) }
|
||||
it { should_not be_able_to(:summary, create(:legislation_process, :past, :not_published)) }
|
||||
|
||||
it { should_not be_able_to(:read, SDG::Goal) }
|
||||
it { should_not be_able_to(:read, SDG::Target) }
|
||||
end
|
||||
|
||||
@@ -108,4 +108,7 @@ describe Abilities::Moderator do
|
||||
it { should_not be_able_to(:comment_as_administrator, proposal) }
|
||||
it { should_not be_able_to(:comment_as_administrator, legislation_question) }
|
||||
end
|
||||
|
||||
it { should_not be_able_to(:read, SDG::Goal) }
|
||||
it { should_not be_able_to(:read, SDG::Target) }
|
||||
end
|
||||
|
||||
@@ -22,4 +22,7 @@ describe "Abilities::Organization" do
|
||||
|
||||
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) }
|
||||
end
|
||||
|
||||
12
spec/models/abilities/sdg/manager.rb
Normal file
12
spec/models/abilities/sdg/manager.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
require "rails_helper"
|
||||
require "cancan/matchers"
|
||||
|
||||
describe "Abilities::SDG::Manager" do
|
||||
subject(:ability) { Ability.new(user) }
|
||||
|
||||
let(:user) { sdg_manager.user }
|
||||
let(:sdg_manager) { create(:sdg_manager) }
|
||||
|
||||
it { should be_able_to(:read, SDG::Goal) }
|
||||
it { should be_able_to(:read, SDG::Target) }
|
||||
end
|
||||
@@ -39,4 +39,7 @@ describe Abilities::Valuator do
|
||||
|
||||
it { should_not be_able_to(:comment_valuation, assigned_investment) }
|
||||
end
|
||||
|
||||
it { should_not be_able_to(:read, SDG::Goal) }
|
||||
it { should_not be_able_to(:read, SDG::Target) }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user