-
Notifications
You must be signed in to change notification settings - Fork 552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stripe::Charge.list difficult to test in rspec 3.8 #687
Comments
…quivalency Overrides `#eql?` (hash equality) and `#hash` so that Stripe objects can be used more easily as Hash keys and that certain other frameworks that rely on these methods will have an easier time (e.g. RSpec's `change`, see #687). I think this might be a little controversial if we weren't already overriding the `#==` implementation, but because we are, I think it makes sense to extent it to these two methods as well.
Alright, we're already overriding BTW, I'd personally be a little cautious with this testing approach. By making checks dependent on |
Fixed in 3.26.1. |
@ob-stripe @brandur-stripe Thanks for the lightning fast response! |
Subject of the issue
I have a working rspec test for
Stripe::Charge.list
that works in rspec 3.7.1 but breaks in rspec 3.8.x. The maintainers of rspec say this is due to a problem with how the Stripe gem defines #hash on its objects.Your environment
Steps to reproduce
The Stripe::Charge.list object id changes every time it is called, even if the data it gives back is the same. Meaning a call like this now fails:
Expected behavior
The expected behaviour is that calls to two Stripe::Charge.list objects should consider not changed if the attributes within that object remain unchanged.
E.g.:
versus
Actual behavior
Instead the actual behaviour is that the .change matcher on 3.8 now detects this new object ID as a change when in 3.7.x it didn't.
I brought this problem up with rpec's maintainers, and they stated it's an issue that should be fixed within the Stripe gem itself. Quote:
The text was updated successfully, but these errors were encountered: