tansengming / stripe-rails

A Rails Engine for integrating with Stripe
MIT License
755 stars 123 forks source link

Make stripe-ruby-mock an optional dependency #88

Closed gaffneyc closed 7 years ago

gaffneyc commented 7 years ago

The currently released version of stripe-ruby-mock has a very specific constraint on the stripe gem (stripe <= 1.58.0, >= 1.31.0) that is causing bundler to drop from 3.x to 1.58.0. While the new testing functionality looks interesting, we shouldn't be forced to use an old version of Stripe just to test our webhooks. By having it be a required dependency we are also forced to load the mocking library into our production application where it won't be used and could have other side effects that we're not aware of.

The easiest way forward would be to remove stripe-ruby-mock from the gemspec. Users of the gem will need to require "stripe/testing" which will then require stripe-ruby-mock and fail if the gem is not installed. We then have the ability to add stripe-ruby-mock to our bundler test group to get that functionality when needed.

On a side note, I would expect it to be require "stripe/rails/testing" since the stripe gem should own the require "stripe/*" namespace and stripe-rails owns the require "stripe/rails/*" namespace.

tansengming commented 7 years ago

Thanks @gaffneyc those are very good points! Getting stripe-ruby-mock onto production would be a very bad idea. Let me think about this a bit more before getting a fix out.

tansengming commented 7 years ago

Just a note that I might actually have to fix namespacing because Stripe might merge this https://github.com/stripe/stripe-ruby/pull/473