Commit 75aafe08
Changed files (3)
app
controllers
api
views
api
v1
cakes
spec
controllers
api
app/controllers/api/v1/cakes_controller.rb
@@ -28,7 +28,6 @@ module Api
def destroy
@cake = current_user.creations.find(params[:id])
@cake.destroy!
- render nothing: true
end
private
app/views/api/v1/cakes/destroy.json.jbuilder
@@ -0,0 +1,1 @@
+json.partial! 'cake', cake: @cake
spec/controllers/api/v1/cakes_controller_spec.rb
@@ -66,7 +66,7 @@ describe Api::V1::CakesController do
end
it "updates the description" do
- new_story = "what's the haps on the craps"
+ new_story = "what is the haps on the craps"
xhr :patch, :update, id: cake.id, cake: { story: new_story }
cake.reload
@@ -93,6 +93,11 @@ describe Api::V1::CakesController do
it "deletes the specified cake" do
expect(Creation.exists?(cake.id)).to be_falsey
end
+
+ it "returns an empty json response" do
+ json = JSON.parse(response.body)
+ expect(json["id"]).to eql(cake.id)
+ end
end
end
end