Search code examples
ruby-on-railscapybara-webkit

NameError: uninitialized constant Capybara::Webkit.configure


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.


Solution

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