Use Webmock instead of Mocha for HTTP stubbing #496
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The test suite currently depends on one special method in the
Stripe
module to stub out HTTP methods in the test suite using the Mocha mocking framework. This is problematic for a couple reasons:RestClient
for something better very difficult. I'm currently trying to tackle Configurable HTTP client #313, and the test suite is turning out to be a major blocker.This PR is going to be very difficult to review because of so much churn, but it only aims to replace HTTP stubbing calls for the most part. There are also a few other miscellaneous improvements introduced to help with consistency:
GET
). This makes it a lot more explicit as to what each test depends on.Stripe.api_base
to get a host instead of just hard-codingapi.stripe.com
..retrieve
instead of.new
+.refresh
. It does the same thing and is more concise, and this makes the whole test suite more consistent with itself (many models were already using.retrieve
).Currently targets #495 (dropping 1.9 support) because Webmock depends on gems that have long since stopped supporting Ruby 1.9.