Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Add params to DELETE" #157

Merged
merged 2 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/spyke/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def uri(uri_template = nil)

def send_request(method, path, params)
connection.send(method) do |request|
if [:get, :delete].include?(method)
if method == :get
path, params = merge_query_params(path, params)
request.url path, params
else
Expand Down
4 changes: 2 additions & 2 deletions lib/spyke/orm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ def save
end
end

def destroy(params = {})
self.attributes = delete(params)
def destroy
self.attributes = delete
end

def update(new_attributes)
Expand Down
2 changes: 1 addition & 1 deletion lib/spyke/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Spyke
VERSION = '7.2.1'
VERSION = '7.2.2'
end
8 changes: 0 additions & 8 deletions test/orm_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,6 @@ def test_to_params_with_custom_root
assert_equal({ 'foto' => { 'url' => 'bob.jpg' } }, Cookbook::Photo.new(url: 'bob.jpg').to_params)
end

def test_destroy_with_params
endpoint = stub_request(:delete, 'http://sushi.com/recipes/1?cascade=true').to_return_json(result: { id: 1, deleted: true })
recipe = Recipe.new(id: 1)
recipe.destroy(cascade: true)
assert recipe.deleted
assert_requested endpoint
end

def test_destroy
endpoint = stub_request(:delete, 'http://sushi.com/recipes/1').to_return_json(result: { id: 1, deleted: true })
recipe = Recipe.new(id: 1)
Expand Down