Swati Sucharita
Swati Sucharita

Reputation: 64

Simulating Internal error in Paypal express sandbox

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

Answers (1)

Benjamin Manns
Benjamin Manns

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

Related Questions