CircleCI上のCapybara::Poltergeist::JavascriptErrorを回避する

井原(@ihara2525)です。

CircleCIでPoltergeistを使ってテストを回しているのですが、PhantomJSのバージョンが古いため(2015/7/27現在1.9.8)、以下のようなエラーが出てしまいました。

Capybara::Poltergeist::JavascriptError:
  One or more errors were raised in the Javascript code on the page. If you don't care about these errors, you can ignore them by setting js_errors: false in your Poltergeist configuration (see documentation for details).

  TypeError: 'undefined' is not a function (evaluating 'ReactElementValidator.createElement.bind(
        null,
        type
      )')

バージョン2系になれば必要なくなるのですが、それまでの間、Gemfileにbind-polyfillを追加することでエラーを回避することができました。

source 'https://rails-assets.org' do
  gem 'rails-assets-bind-polyfill', '~> 1.0'
end

簡単ですが、以上です!