spec/stub_helper.rb in airborne-0.0.18 vs spec/stub_helper.rb in airborne-0.0.19
- old
+ new
@@ -4,26 +4,26 @@
def initialize
@base_url = 'http://www.example.com/'
end
- def mock_get(url, response_headers = {})
- stub_request(:get, @base_url + url).to_return(headers: response_headers, body: get_json_response_file(url))
+ def mock_get(url, response_headers = {}, status = 200)
+ stub_request(:get, @base_url + url).to_return(headers: response_headers, body: get_json_response_file(url), status: status)
end
- def mock_post(url, options = {})
+ def mock_post(url, options = {}, status = 200)
stub_request(:post, @base_url + url).with(body: options[:request_body] || {})
- .to_return(headers: options[:response_headers] || {}, body: get_json_response_file(url))
+ .to_return(headers: options[:response_headers] || {}, body: get_json_response_file(url), status: status)
end
- def mock_put(url, options = {})
+ def mock_put(url, options = {}, status = 200)
stub_request(:put, @base_url + url).with(body: options[:request_body] || {})
- .to_return(headers: options[:response_headers] || {}, body: get_json_response_file(url))
+ .to_return(headers: options[:response_headers] || {}, body: get_json_response_file(url), status: status)
end
- def mock_patch(url, options = {})
+ def mock_patch(url, options = {}, status = 200)
stub_request(:patch, @base_url + url).with(body: options[:request_body] || {})
- .to_return(headers: options[:response_headers] || {}, body: get_json_response_file(url))
+ .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)
end
\ No newline at end of file