-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add grape endpoint to delete an artwork
- Loading branch information
1 parent
3951e3a
commit 50647e0
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require "rails_helper" | ||
|
||
describe "DELETE /api/using_grape/artworks/:id" do | ||
let(:artwork) { FactoryBot.create(:artwork) } | ||
|
||
context "with an invalid id" do | ||
it "returns a 404" do | ||
delete "/api/using_grape/artworks/invalid" | ||
expect(response.status).to eq 404 | ||
end | ||
end | ||
|
||
context "with a valid id" do | ||
it "returns a 200" do | ||
delete "/api/using_grape/artworks/#{artwork.id}" | ||
expect(response.status).to eq 200 | ||
expect(Artwork.count).to eq 0 | ||
end | ||
end | ||
end |