Mangopay / mangopay2-ruby-sdk

Ruby Gem for MANGOPAY
https://rubygems.org/gems/mangopay
MIT License
42 stars 38 forks source link

Rspec stubbing: Your authorization do not allow you to access to this information #32

Closed terry90 closed 9 years ago

terry90 commented 9 years ago

I encounter the issue described here: #12 Using Rails 4.2.3, MangoPay SDK v3.0.18

I am writing my tests, I stub every request coming from api.sandbox.mangopay.com I monkey patched MangoPay.request to be sure that my stubbed responses are corrects and there is no difference in the JSON. (Didn't change the behavior, it is just logging)

When testing legal user creation, MangoPay sdk throw me this error: Your authorization do not allow you to access to this information

This is the critical part of the code:

if status.personal?
  MangoPay::NaturalUser.create(user_hash)
else
  MangoPay::LegalUser.create(user_hash)
end

I'll investigate further

This error is not thrown each time I launch my tests while the behavior of the tests do not change. Any clue ?

terry90 commented 9 years ago

Well, my bad. I use webmock, but unfortunately it was disabled for a bunch of tests. What is strange is that it was not disabled all the time...

hobailey commented 9 years ago

Hey @terry90, thanks for the update and I'm glad the problem is resolved :-)