Reputation: 64
I have some special actions defined for the case when requesting to Paypal returns Internal errors(10001). I want to regenerate the condition so that I can test my code. I also want to test the other failure cases.
How to run negative tests for Paypal express sandbox?
Upvotes: 0
Views: 162
Reputation: 9148
I would suggest using something like webmock to stub out these error requests (if not all of them). For a fancier front-end, you can use an abstraction like vcr to generate the stub requests.
You can do something like,
stub_request(:any, "www.example.com").to_return(:status => [500, "Internal Server Error"])
But be sure to get he correct status code and body content for PayPal errors.
Upvotes: 2