Ask A Question

Notifications

You’re not receiving notifications from this thread.

Testing HTTP Requests with Webmock Discussion

Great episode! Instead of testing private methods directly, I suggest to define a FakeApiClient class that extends ApplicationClient with some dummy methods. This allows testing public methods. Plus, it allows you to remove the BASE_URI constant from ApplicationClient and define it in FakeApiClient.

Reply

I think is a nice idea. On the other hand I like how he does here is easy to understand.

Reply

You'll want to do that for your actual integrations, for sure.

These are just some tests to make sure we've implemented the generic HTTP calls correctly. That way our real API clients don't have to worry about testing the underlying HTTP methods, they can focus on everything else.

Reply

I'm loving this series. Awesome work!

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 85,376+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.