Improved public_for_api scopes and corresponding specs

This commit is contained in:
Alberto Miedes Garcés
2017-01-26 18:29:59 +01:00
parent 5b7cbccd19
commit 4b7cebf686
5 changed files with 98 additions and 5 deletions

View File

@@ -134,7 +134,7 @@ describe Comment do
end
end
describe "public_for_api" do
describe "public_for_api scope" do
it "returns comments" do
comment = create(:comment)
@@ -174,5 +174,12 @@ describe Comment do
expect(Comment.public_for_api).not_to include(comment)
end
it 'does not return comments on budget investments' do
budget_investment = create(:budget_investment)
comment = create(:comment, commentable: budget_investment)
expect(Comment.public_for_api).not_to include(comment)
end
end
end