NameError: 未初始化的常量 Capybara::Webkit.configure [英] NameError: uninitialized constant Capybara::Webkit.configure

查看:48
本文介绍了NameError: 未初始化的常量 Capybara::Webkit.configure的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一定没有正确理解在哪里放置这个方法调用.我有这个 test_helper.rb 文件

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

当我运行 rake test

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

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

似乎我正在执行 Capybara-webkit Github 页面上 README 中描述的内容.

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

推荐答案

这可能是 spring gem 版本与 rspec 版本的兼容性问题.我更新了 gem 并解决了.

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

这篇关于NameError: 未初始化的常量 Capybara::Webkit.configure的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆