Capybara:Module 的未定义方法 `default_max_wait_time=' (NoMethodError)

undefined method `default_max_wait_time=' for Capybara:Module (NoMethodError)

我遇到了这个错误

undefined method `default_max_wait_time=' for Capybara:Module (NoMethodError)

当我尝试 运行 功能规格时,例如

$ rspec spec/features/auto_policies/3_step_minimal_foundation_spec.rb

...
Performance on MRI may be improved with the concurrent-ruby-ext gem. Please see http://concurrent-ruby.com ...
/Users/mdurrant/eq/lynx/spec/support/capybara.rb:69:in `<top (required)>': undefined method `default_max_wait_time=' for Capybara:Module (NoMethodError)

我已经将 Gemfile 更新到最新的水豚 (2.4.4),但我仍然收到此消息

如何解决这个问题?

default_max_wait_time= 是在 2.5.0 中添加的。 2.4.4中,方法还是default_wait_time=

您需要升级到更新的版本。目前最新的是2.6.2.

在你的水豚2.4.4版本中,使用的方法是“Capybara.default_wait_time”。 “Capybara.default_wait_time”在 2.5.0 版中更改为“Capybara.default_max_wait_time”,因为它更清楚地解释了其用途。

因此,您要么在当前版本 (2.4.4) 中使用“Capybara.default_wait_time”,要么升级到 2.5.0 或更高版本。当前最新版本为2.6.2,于2016年1月27日发布。有关详细信息,请参阅以下 link: https://github.com/jnicklas/capybara/blob/master/History.md