NameError: uninitialized constant Capybara::Webkit.configure

我的梦境 提交于 2020-01-23 09:59:11

问题


I must not be understanding correctly where to place this method call. I have this test_helper.rb file

ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)

require 'rails/test_help'
require 'minitest/rails/capybara'
require 'capybara'
require 'capybara/rails'
require 'capybara/webkit'

Dir[Rails.root.join('test/support/**/*.rb')].each { |f| require f }

Capybara::Webkit.configure do |config|
  config.allow_unknown_urls
end

And I get this error when I run rake test

NoMethodError: undefined method configure' for Capybara::Webkit:Module /Users/sameer/code/rails/door_app/test/test_helper.rb:XX:in'

It seems like I'm doing what's described in the README at the Capybara-webkit Github page.


回答1:


It could be an issue with spring gem version compatibility with rspec version. I updated the gem and it was solved.




回答2:


I had the same issue, fixed by upgrading capybara-webkit from 1.5.2 to 1.6.0.




回答3:


You need to install a gem

group :test do
  ...
  gem 'capybara-webkit'

end



回答4:


I had the same issue, fixed by restarting spring server spring stop. Used capybara-webkit 1.11.1



来源:https://stackoverflow.com/questions/31225895/nameerror-uninitialized-constant-capybarawebkit-configure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!