5

How can I test Paypal Express with ActiveMerchant in a Rails 3.2 app with rspec/capybara integration test?

robzolkos
  • 2,196
  • 3
  • 30
  • 47

1 Answers1

1

You can test by setting:

ActiveMerchant::Billing::Base.mode = :test

PayPal however will require you to enter complete billing information or the API won't even accept it and will return:

Error: There's an error with this transaction. Please enter a complete billing address.

In which case you can supply it with some generic info:

:billing_address => {
    :name     => "Test Person",
    :address1 => "123 W 423 E",
    :city     => "Somewhere",
    :state    => "CA",
    :country  => "US",
    :zip      => "88888"
 }
sjain
  • 23,126
  • 28
  • 107
  • 185
  • 2
    I'm aware of how to activate test mode with the gateway. My question was how I write an automated integration test with rspec/capybara. – robzolkos Jan 30 '13 at 12:37