Can clear flags on deleted posts if you're a moderator

This commit is contained in:
Robin Ward
2013-02-08 19:04:14 -05:00
parent ea631e75c9
commit 03a798b202
6 changed files with 90 additions and 11 deletions

View File

@ -68,6 +68,29 @@ describe Guardian do
end
describe "can_clear_flags" do
let(:post) { Fabricate(:post) }
let(:user) { post.user }
let(:moderator) { Fabricate(:moderator) }
it "returns false when the user is nil" do
Guardian.new(nil).can_clear_flags?(post).should be_false
end
it "returns false when the post is nil" do
Guardian.new(moderator).can_clear_flags?(nil).should be_false
end
it "returns false when the user is not a moderator" do
Guardian.new(user).can_clear_flags?(post).should be_false
end
it "returns true when the user is a moderator" do
Guardian.new(moderator).can_clear_flags?(post).should be_true
end
end
describe 'can_send_private_message' do
let(:user) { Fabricate(:user) }
let(:another_user) { Fabricate(:user) }