0
votes

Using Webmock, I'd like the stub to simply return the called body params. For example, I am calling the Mandrill API and passing an options hash.

I've tried this, but it is giving me an error:

@mandrill = stub_request(:any, "https://mandrillapp.com/api/1.0/").to_return(body: *)

How can I achieve this?

1

1 Answers

1
votes

Solved!

module ApiStubs

  def stub_apis
    @mandrill = stub_request(:any, "https://mandrillapp.com/api/1.0/").to_return { |request| {body: request.body} }
  end

end