Adds new abilities for proposals

This commit is contained in:
kikito
2015-09-13 20:27:35 +02:00
parent df7fde472b
commit 50148f0aaf
2 changed files with 12 additions and 0 deletions

View File

@@ -71,8 +71,14 @@ class Ability
can :ignore_flag, Proposal, ignored_flag_at: nil, hidden_at: nil
cannot :ignore_flag, Proposal, author_id: user.id
can :moderate, Proposal
cannot :moderate, Proposal, author_id: user.id
can :hide, User
cannot :hide, User, id: user.id
can :block, User
cannot :block, User, id: user.id
end
if user.moderator?

View File

@@ -198,9 +198,15 @@ describe Ability do
it { should_not be_able_to(:ignore_flag, ignored_proposal) }
it { should_not be_able_to(:ignore_flag, own_proposal) }
it { should be_able_to(:moderate, proposal) }
it { should_not be_able_to(:moderate, own_proposal) }
it { should_not be_able_to(:hide, user) }
it { should be_able_to(:hide, other_user) }
it { should_not be_able_to(:block, user) }
it { should be_able_to(:block, other_user) }
it { should_not be_able_to(:restore, comment) }
it { should_not be_able_to(:restore, debate) }
it { should_not be_able_to(:restore, proposal) }