adds scope for only normal user comments

This commit is contained in:
Juanjo Bazán
2015-11-12 12:15:36 +01:00
parent a881ced801
commit c258a4f3b4
2 changed files with 12 additions and 0 deletions

View File

@@ -117,4 +117,15 @@ describe Comment do
expect(comment.author_id).to eq(comment.user.id)
end
end
describe "not_as_admin_or_moderator" do
it "returns only comments posted as regular user" do
comment1 = create(:comment)
create(:comment, administrator_id: create(:administrator).id)
create(:comment, moderator_id: create(:moderator).id)
expect(Comment.not_as_admin_or_moderator.size).to eq(1)
expect(Comment.not_as_admin_or_moderator.first).to eq(comment1)
end
end
end