我编写了一个应用程序(使用 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
如果这不是测试 Action 电缆的方法,我该怎么做?
最佳答案
您很可能使用旧版本的 phantomjs,它不支持 bind
。升级到 phantomjs 2.1.1+
关于ruby-on-rails - capybara Poltergeist ActionCable 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36529124/