FIX: A blocked user should not be able to moderate anything.

This commit is contained in:
Guo Xiang Tan
2016-06-20 15:41:17 +08:00
parent e72684f9dc
commit dfdc54957c
2 changed files with 15 additions and 2 deletions

View File

@@ -1208,6 +1208,14 @@ describe Guardian do
expect(Guardian.new(user).can_moderate?(nil)).to be_falsey
end
context 'when user is blocked' do
it 'returns false' do
user.toggle!(:blocked)
expect(Guardian.new(user).can_moderate?(post)).to be(false)
expect(Guardian.new(user).can_moderate?(topic)).to be(false)
end
end
context 'a Topic' do
it 'returns false when not logged in' do