adds abilities for commenting as moderator/admin
This commit is contained in:
@@ -66,10 +66,15 @@ class Ability
|
|||||||
cannot :hide, User, id: user.id
|
cannot :hide, User, id: user.id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if user.moderator?
|
||||||
|
can :comment_as_moderator, [Debate, Comment]
|
||||||
|
end
|
||||||
|
|
||||||
if user.administrator?
|
if user.administrator?
|
||||||
can :restore, Comment
|
can :restore, Comment
|
||||||
can :restore, Debate
|
can :restore, Debate
|
||||||
can :restore, User
|
can :restore, User
|
||||||
|
can :comment_as_administrator, [Debate, Comment]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -22,13 +22,15 @@ describe Ability do
|
|||||||
it { should be_able_to(:show, debate) }
|
it { should be_able_to(:show, debate) }
|
||||||
it { should be_able_to(:vote, debate) }
|
it { should be_able_to(:vote, debate) }
|
||||||
|
|
||||||
|
|
||||||
it { should be_able_to(:show, user) }
|
it { should be_able_to(:show, user) }
|
||||||
it { should be_able_to(:edit, user) }
|
it { should be_able_to(:edit, user) }
|
||||||
|
|
||||||
it { should be_able_to(:create, Comment) }
|
it { should be_able_to(:create, Comment) }
|
||||||
it { should be_able_to(:vote, Comment) }
|
it { should be_able_to(:vote, Comment) }
|
||||||
|
|
||||||
|
it { should_not be_able_to(:comment_as_administrator, debate) }
|
||||||
|
it { should_not be_able_to(:comment_as_moderator, debate) }
|
||||||
|
|
||||||
describe 'flagging content as inappropiate' do
|
describe 'flagging content as inappropiate' do
|
||||||
it { should be_able_to(:flag_as_inappropiate, debate) }
|
it { should be_able_to(:flag_as_inappropiate, debate) }
|
||||||
it { should_not be_able_to(:undo_flag_as_inappropiate, debate) }
|
it { should_not be_able_to(:undo_flag_as_inappropiate, debate) }
|
||||||
@@ -158,6 +160,9 @@ describe Ability do
|
|||||||
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) }
|
it { should_not be_able_to(:restore, other_user) }
|
||||||
|
|
||||||
|
it { should be_able_to(:comment_as_moderator, debate) }
|
||||||
|
it { should_not be_able_to(:comment_as_administrator, debate) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -173,5 +178,8 @@ 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) }
|
it { should be_able_to(:restore, other_user) }
|
||||||
|
|
||||||
|
it { should be_able_to(:comment_as_administrator, debate) }
|
||||||
|
it { should_not be_able_to(:comment_as_moderator, debate) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user