不确定这是否是Capybara问题,但我刚刚重新安装了Rails(4.1.1)和Rspec Rails(3.0.1),我想使用Capybara(2.3.0),但从未使用过它,我遇到了问题.我在spec/features中创建了一个"规范",规范本身按照预期运行和通过,但在运行rspec时,我收到了以下"警告".有什么 idea 吗?我需要禁用ruby级别的警告吗?

/Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/mail-2.5.4/lib/mail/network/delivery_methods/sendmail.rb:53: warning: shadowing outer local variable - to
/Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247: warning: loading in progress, circular require considered harmful - /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/capybara-2.3.0/lib/capybara.rb
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/bin/ruby_executable_hooks:15:in  `<main>'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/bin/ruby_executable_hooks:15:in  `eval'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/bin/rspec:23:in  `<main>'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/bin/rspec:23:in  `load'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/rspec-core-3.0.0/exe/rspec:4:in  `<top (required)>'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/rspec-core-3.0.0/lib/rspec/core/runner.rb:38:in  `invoke'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/rspec-core-3.0.0/lib/rspec/core/runner.rb:70:in  `run'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/rspec-core-3.0.0/lib/rspec/core/runner.rb:85:in  `run'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/rspec-core-3.0.0/lib/rspec/core/runner.rb:97:in  `setup'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/rspec-core-3.0.0/lib/rspec/core/configuration.rb:1051:in  `load_spec_files'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/rspec-core-3.0.0/lib/rspec/core/configuration.rb:1051:in  `each'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/rspec-core-3.0.0/lib/rspec/core/configuration.rb:1051:in  `block in load_spec_files'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/rspec-core-3.0.0/lib/rspec/core/configuration.rb:1051:in  `load'
    from /Users/typeoneerror/Dev/Doki/engines/doki_core/spec/features/accounts/sign_up_spec.rb:1:in  `<top (required)>'
    from /Users/typeoneerror/Dev/Doki/engines/doki_core/spec/features/accounts/sign_up_spec.rb:1:in  `require'
    from /Users/typeoneerror/Dev/Doki/engines/doki_core/spec/rails_helper.rb:7:in  `<top (required)>'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in  `require'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in  `load_dependency'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in  `block in require'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in  `require'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/rspec-rails-3.0.1/lib/rspec/rails.rb:9:in  `<top (required)>'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in  `require'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in  `load_dependency'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in  `block in require'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in  `require'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/rspec-rails-3.0.1/lib/rspec/rails/vendor/capybara.rb:2:in  `<top (required)>'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in  `require'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in  `load_dependency'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in  `block in require'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in  `require'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/capybara-2.3.0/lib/capybara/rspec.rb:1:in  `<top (required)>'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in  `require'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in  `load_dependency'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in  `block in require'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in  `require'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/capybara-2.3.0/lib/capybara.rb:5:in  `<top (required)>'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/capybara-2.3.0/lib/capybara.rb:320:in  `<module:Capybara>'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in  `require'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in  `load_dependency'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in  `block in require'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in  `require'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/capybara-2.3.0/lib/capybara/dsl.rb:1:in  `<top (required)>'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in  `require'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in  `load_dependency'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in  `block in require'
    from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in  `require'
/Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/capybara-2.3.0/lib/capybara/node/matchers.rb:121: warning: assigned but unused variable - e
/Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/capybara-2.3.0/lib/capybara/selenium/driver.rb:119: warning: assigned but unused variable - a

推荐答案

.rspec中移除--warnings.rspec 3.0.0中的生成器包含了这个设置,但我们意识到这是一个错误——虽然鼓励用户编写无警告代码是好的,但用户在不确定原因的情况下获取这些警告会让人困惑.

欲了解更多信息:

https://github.com/rspec/rspec-core/issues/1571

Ruby-on-rails相关问答推荐

如何使用 Rails 语义记录器记录整个请求(标头、正文等)

刺激不添加侦听器以搜索表单输入

Ruby on Rails/Activerecord 排序自引用查询?

计算总价(商品数量*商品价格)

Ruby 3 动态关键字参数

您如何测试方法调用块内调用的方法,以及使用 rspec 在块内传递给该方法调用的内容

验证模型属性大于另一个

键入rails 控制台无法启动?

Devise + Omniauth - 如何传递额外的参数?

Rails Migration将字符串转换为整数?

使用brew 软件安装了 elasticsearch,但找不到配置文件

撬Ruby 如何重新加载?

如果 URL 不存在,请将 http(s) 添加到 URL?

rails 4.0, rake db:sessions:create

在 where 查询中查找 nil has_one 关联

Ruby on Rails:如何从显示的子资源中获取错误消息?

我应该在 Heroku Cedar 上使用薄的还是独角兽

您如何查看 ruby​​ 中的调用堆栈示例?

ActionMailer 在开发 Rails 4 中不发送邮件

如何为 Rails 控制器添加延迟以进行测试?