问题
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