Capybara Poltergeist ActionCable 测试

Capybara Poltergeist ActionCable testing

我写了一个应用程序(with rails 5.0.0beta3),它有几个使用 ActionCable.
的实时更新 所以我想测试一下我写的东西。我将 poltergeist 添加到我的 Gemfile 并将其捆绑,并 运行 一个示例。
Javascript 正确执行。

但是当 sprocket 尝试添加 action_cable 时失败了:

TypeError: 'undefined' is not a function (evaluating 'this.events[eventName].bind(this)')
TypeError: 'undefined' is not a function (evaluating 'this.events[eventName].bind(this)')
    at http://127.0.0.1:63829/assets/application-2d6ae1aa6efc25d4e4902c5f2d384b5473eb4bdcc9489a9857608e6fe9952eb5.js:12789
...

我认为这来自 this line right here

如果这不是测试动作电缆的方法,我应该怎么做?

您很可能使用的是旧版本的 phantomjs,它不支持 bind。升级到 phantomjs 2.1.1+