test/support/restfully_accesible_stub.rb in yao-0.19.0 vs test/support/restfully_accesible_stub.rb in yao-0.20.0
- old
+ new
@@ -49,9 +49,32 @@
headers: {'Content-Type' => 'application/json'},
body: response.to_json
)
end
+ def stub_put_request(url, body, response = {})
+ stub_request(:put,url)
+ .with(
+ headers: request_headers.merge({'Content-Type' => 'application/json'}),
+ body: body.to_json,
+ ).to_return(
+ status: 200,
+ headers: {'Content-Type' => 'application/json'},
+ body: response.to_json
+ )
+ end
+
+ def stub_delete_request(url, response = {})
+ stub_request(:delete,url)
+ .with(
+ headers: request_headers
+ ).to_return(
+ status: 200,
+ headers: {'Content-Type' => 'application/json'},
+ body: response.to_json
+ )
+ end
+
def request_headers
{'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>"Yao/#{Yao::VERSION} Faraday/#{Faraday::VERSION}"}
end
end