ruby-on-railsphantomjscapybarabraintree

BraintreeError: Cannot contact the gateway at this time (during system/integration specs only)


originally from https://github.com/braintree/braintree-web/issues/296

General information

Using braintree-web gem with Spree store

SDK version: 3.2.0 Environment: test environment using rspec Browser and OS: Poltergeist running phantomjs Issue description

We get this error running our specs under Poltergeist and Phantom JS. We are using Phantom JS 2.1.1:

BraintreeError: Cannot contact the gateway at this time

The symptom does not appear for our Production app, only for the test run environment testing our app, running Capubara * Rspec (using poltergeis/phantomjs)


Solution

  • for the posterity of the issue, just waned to report back for others that we confirmed the root cause of this was an (unintentional) double-invocations of window.braintree.client(...) functional itself.. When we corrected our code not to double invoke that function, the problem went away. As explained above, symptom did not seem to manifest in Production, only in the phantomjs (with capybara/rspec) test environment.

    Good to close as this was from our own refactor.