WebMock v1.16.0 Release Notes
-
👍 Allow a Pathname to be passed as a Response body
stub_request(:get, /example.com/).to_return( body: Rails.root.join('test/fixtures/foo.txt') )
Thanks to Ben Pickles
hash_including
matcher can be initialized with empty keys to match any values.stub_request(:post, "www.example.com").with(:body => hash_including(:a, :b => {'c'})) RestClient.post('www.example.com', '{"a":"1","b":"c"}', :content_type => 'application/json')
Thanks to Stefano Uliari