adds as_moderator/administrator methods to comment

This commit is contained in:
Juanjo Bazán
2015-08-24 17:47:09 +02:00
parent 46643185f8
commit 57228636c4
2 changed files with 30 additions and 1 deletions

View File

@@ -38,4 +38,24 @@ describe Comment do
expect { new_comment.destroy }.to change { comment.children_count }.from(1).to(0)
end
end
describe "#as_administrator?" do
it "should be true if comment has administrator_id, false otherway" do
expect(comment).not_to be_as_administrator
comment.administrator_id = 33
expect(comment).to be_as_administrator
end
end
describe "#as_moderator?" do
it "should be true if comment has moderator_id, false otherway" do
expect(comment).not_to be_as_moderator
comment.moderator_id = 21
expect(comment).to be_as_moderator
end
end
end