
上QQ阅读APP看书,第一时间看更新
How to do it...
Now that you have webmock included in your project, you can start stubbing HTTP requests in your specs. Once again, open specs/spec_helper.rb and add the following content:
stub_request(:post, "attachment-service.yourorg.example.com"). with(body: {media_type: 1}, headers: {"Content-Type" => /image\/.+/}). to_return(body: { foo: bar })