Skip to content

Commit

Permalink
Add DELETE functionality when options are passed in
Browse files Browse the repository at this point in the history
  • Loading branch information
David Hale committed Aug 12, 2015
1 parent 32b138e commit d8a515e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/airborne/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def put(url, put_body = nil, headers = nil)
@response = make_request(:put, url, body: put_body, headers: headers)
end

def delete(url, headers = nil)
@response = make_request(:delete, url, headers: headers)
def delete(url, delete_body = nil, headers = nil)
@response = make_request(:delete, url, body: delete_body, headers: headers)
end

def head(url, headers = nil)
Expand Down
2 changes: 1 addition & 1 deletion spec/airborne/delete_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe 'delete' do
it 'should allow testing on delete requests' do
mock_delete 'simple_delete'
delete '/simple_delete'
delete '/simple_delete', {}
expect_status 200
end
end
5 changes: 3 additions & 2 deletions spec/stub_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ def mock_patch(url, options = {}, status = 200)
.to_return(headers: options[:response_headers] || {}, body: get_json_response_file(url), status: status)
end

def mock_delete(url)
stub_request(:delete, @base_url + url)
def mock_delete(url, options = {}, status = 200)
stub_request(:delete, @base_url + url).with(body: options[:request_body] || {})
.to_return(headers: options[:response_headers] || {}, body: get_json_response_file(url), status: status)
end

def mock_head(url, response_headers = {}, status = 200)
Expand Down

0 comments on commit d8a515e

Please sign in to comment.