adds new abilities
This commit is contained in:
committed by
Juanjo Bazán
parent
bd16e9345a
commit
259aa29de7
@@ -28,11 +28,13 @@ class Ability
|
|||||||
|
|
||||||
can :hide, Comment
|
can :hide, Comment
|
||||||
can :hide, Debate
|
can :hide, Debate
|
||||||
|
can :hide, User
|
||||||
end
|
end
|
||||||
|
|
||||||
if user.administrator?
|
if user.administrator?
|
||||||
can :restore, Comment
|
can :restore, Comment
|
||||||
can :restore, Debate
|
can :restore, Debate
|
||||||
|
can :restore, User
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ describe Ability do
|
|||||||
describe "Moderator" do
|
describe "Moderator" do
|
||||||
let(:user) { create(:user) }
|
let(:user) { create(:user) }
|
||||||
before { create(:moderator, user: user) }
|
before { create(:moderator, user: user) }
|
||||||
|
let(:other_user) { create(:user) }
|
||||||
|
|
||||||
it { should be_able_to(:index, Debate) }
|
it { should be_able_to(:index, Debate) }
|
||||||
it { should be_able_to(:show, debate) }
|
it { should be_able_to(:show, debate) }
|
||||||
@@ -88,14 +89,17 @@ describe Ability do
|
|||||||
|
|
||||||
it { should be_able_to(:hide, comment) }
|
it { should be_able_to(:hide, comment) }
|
||||||
it { should be_able_to(:hide, debate) }
|
it { should be_able_to(:hide, debate) }
|
||||||
|
it { should be_able_to(:hide, other_user) }
|
||||||
|
|
||||||
it { should_not be_able_to(:restore, comment) }
|
it { should_not be_able_to(:restore, comment) }
|
||||||
it { should_not be_able_to(:restore, debate) }
|
it { should_not be_able_to(:restore, debate) }
|
||||||
|
it { should_not be_able_to(:restore, other_user) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "Administrator" do
|
describe "Administrator" do
|
||||||
let(:user) { create(:user) }
|
let(:user) { create(:user) }
|
||||||
before { create(:administrator, user: user) }
|
before { create(:administrator, user: user) }
|
||||||
|
let(:other_user) { create(:user) }
|
||||||
|
|
||||||
it { should be_able_to(:index, Debate) }
|
it { should be_able_to(:index, Debate) }
|
||||||
it { should be_able_to(:show, debate) }
|
it { should be_able_to(:show, debate) }
|
||||||
@@ -103,5 +107,6 @@ describe Ability do
|
|||||||
|
|
||||||
it { should be_able_to(:restore, comment) }
|
it { should be_able_to(:restore, comment) }
|
||||||
it { should be_able_to(:restore, debate) }
|
it { should be_able_to(:restore, debate) }
|
||||||
|
it { should be_able_to(:restore, other_user) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user