Skip to content
This repository has been archived by the owner on Sep 14, 2021. It is now read-only.

Commit

Permalink
if delete request's reply is 404 don't raise
Browse files Browse the repository at this point in the history
  • Loading branch information
ElvinEfendi committed Apr 7, 2017
1 parent ab9248c commit 9d1fab0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/doggy/model.rb
Expand Up @@ -212,7 +212,7 @@ def save
end

def destroy
request(:delete, resource_url(id))
self.class.request(:delete, resource_url(id), nil, [404])
end

def destroy_local
Expand Down
2 changes: 1 addition & 1 deletion test/doggy/cli/delete_test.rb
Expand Up @@ -25,7 +25,7 @@ def test_run_when_remote_destroy_fails
[screen, monitor].each do |resource|
resource.path = Tempfile.new("#{resource.prefix}-#{resource.id}.json").path
stub_request(:delete, "https://app.datadoghq.com/api/v1/#{resource.prefix}/#{resource.id}?api_key=api_key_123&application_key=app_key_345").
to_return(status: 200, body: JSON.dump("deleted_#{resource.class.name.split('::').last.downcase}_id" => resource.id))
to_return(status: 404, body: JSON.dump("deleted_#{resource.class.name.split('::').last.downcase}_id" => resource.id))
File.expects(:delete).with(resource.path)
end
Doggy::CLI::Delete.new.run([screen.id.to_s, monitor.id.to_s])
Expand Down

0 comments on commit 9d1fab0

Please sign in to comment.