Rspec /水豚正在加载,通报要求认为有害 [英] Rspec/Capybara loading in progress, circular require considered harmful

查看:56
本文介绍了Rspec /水豚正在加载,通报要求认为有害的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不确定这是否是Capybara的问题,但是我只是重新安装了Rails(4.1.1)和Rspec Rails(3.0.1),我想使用Capybara(2.3.0),但从未使用过我遇到了问题。我在 spec / features 中创建了一个 spec,并且该规范本身可以按预期运行并通过,但是在运行rspec时出现以下警告。有任何想法吗?我是否只需要禁用红宝石级别的警告?

  /Users/typeoneerror/.rvm/gems/ruby- 2.1.2@doki/gems/mail-2.5.4/lib/mail/network/delivery_methods/sendmail.rb:53:警告:隐藏外部局部变量-至
/Users/typeoneerror/.rvm/gems/ ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:警告:正在加载,通知要求有害-/Users/typeoneerror/.rvm/gems/ruby-2.1 .2 @ doki / gems / capybara-2.3.0 / lib / capybara.rb
来自/Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/bin/ruby_executable_hooks:15:in` ; main>'
来自/Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/bin/ruby_executable_hooks:15:在`eval'中
来自/Users/typeoneerror/.rvm/ gems/ruby-2.1.2@doki/bin/rspec:23:在/Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/bin/rspec中的< main>
中: 23:在/Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/rspec-core-3.0.0/exe/rspec:4:in的`load'
中< top(必需)>
来自/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:在/Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/rspec-core-3.0.0/lib/rspec/core/runner.rb的`run'
中: 85:来自/Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/rspec-core-3.0.0/lib/rspec/core/runner.rb:97中的'run'
:在/Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/rspec-core-3.0.0/lib/rspec/core/configuration.rb:1051的`setup'
中:在/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'
中来自/Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/rspec-core-3.0.0/lib/rspec/core/configuration.rb:1051:in中的每个
从/Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/rspec中的load_spec_files的
中阻止-core-3.0.0 / lib / rspec / core / configuration.rb:1051:在/Users/typeoneerror/Dev/Doki/engines/doki_core/spec/features/accounts/sign_up_spec.rb的'load'
中:1:在`< top(必需)>'中
来自/Users/typeoneerror/Dev/Doki/engines/doki_core/spec/features/accounts/sign_up_spec.rb:1:在`require'$ b中$ b来自/Users/typeoneerror/Dev/Doki/engines/doki_core/spec/rails_helper.rb:7:in`< top(必填)>'
来自/Users/typeoneerror/.rvm/gems/ ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:在'require'
from /Users/typeoneerror/.rvm/gems/ruby-2.1.2 @ doki / gems / activesupport-4.1.1 / lib / active_support / dependencies.rb:232:来自/Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/中的'load_dependency'
activesupport-4.1.1 / lib / active_support / dependencies.rb:247:在'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'
fr om /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/rspec-rails-3.0.1/lib/rspec/rails.rb:9:in`< top(required)>'
来自/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:来自/ Users / typeoneerror /中的`load_dependency'
.rvm / gems / ruby​​-2.1.2 @ doki / gems / activesupport-4.1.1 / lib / active_support / dependencies.rb:247:在/Users/typeoneerror/.rvm/中的'block in require'
gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:在'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(必需)>'
来自/ Users / typeoneerror / .rvm / gems / ruby​​-2.1.2 @ doki / gems / activesupport-4.1.1 / lib / active_support / dependencies.rb:247:在来自/ Users / t的'require'
中ypeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:来自/Users/typeoneerror/.rvm/中的'load_dependency'
gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in来自/Users/typeoneerror/.rvm/gems/ruby的'block in require'
-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:在'require'
from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@ doki / gems / capybara-2.3.0 / lib / capybara / rspec.rb:1:在/Users/typeoneerror/.rvm/gems/ruby-2.1中的'< top(必需)>'
中。 2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:在'require'
from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems /activesupport-4.1.1/lib/active_support/dependencies.rb:232:来自/Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1的 load_dependency
。 1 / lib / active_support / dependencies.rb:247:在来自/ Users / typeon的'block in require'
中eerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:在'require'
from /Users/typeoneerror/.rvm/ gems/ruby-2.1.2@doki/gems/capybara-2.3.0/lib/capybara.rb:5:在/Users/typeoneerror/.rvm/中的< top(必填)>'
中gems/ruby-2.1.2@doki/gems/capybara-2.3.0/lib/capybara.rb:320:在`< module:Capybara>'中
来自/Users/typeoneerror/.rvm/gems/ ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:在'require'
from /Users/typeoneerror/.rvm/gems/ruby-2.1.2 @ doki / gems / activesupport-4.1.1 / lib / active_support / dependencies.rb:232:来自/Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/中的'load_dependency'
activesupport-4.1.1 / lib / active_support / dependencies.rb:247:在'block in require'
from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1 .1 / lib / active_support / dependencies.rb:247:在'require'
中/Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gem s / capybara-2.3.0 / lib / capybara / dsl.rb:1:位于/Users/typeoneerror/.rvm/gems/ruby-2.1.2@中的< top(必需)>
doki / gems / activesupport-4.1.1 / lib / active_support / dependencies.rb:247:在'require'
from /Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport -4.1.1 / lib / active_support / dependencies.rb:232:来自/Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/中的'load_dependency'
lib / active_support / dependencies.rb:247:在/Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/activesupport-4.1.1/lib/active_support的'block in require'
中/dependencies.rb:247:在'require'
中/Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/capybara-2.3.0/lib/capybara/node/matchers.rb :121:警告:已分配但未使用的变量-e
/Users/typeoneerror/.rvm/gems/ruby-2.1.2@doki/gems/capybara-2.3.0/lib/capybara/selenium/driver.rb :119:警告:已分配但未使用的变量-a


解决方案

删除e -警告来自 .rspec 。 rspec 3.0.0中的生成器包括此设置,但我们已经意识到这是一个错误-鼓励用户编写无警告的代码固然很好,但用户却不确定为什么得到这些警告会令人困惑。 p>

有关更多信息:



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


Unsure if this is a Capybara issue, but I just did a fresh install of Rails (4.1.1) and Rspec Rails (3.0.1) and I would like to use Capybara (2.3.0), but having never used it I'm running into issues. I created a "spec" in spec/features and the spec itself runs and passes as expected, but I get the following "warnings" when rspec is run. Any ideas? Do I just need to disable warnings at the ruby level or something?

/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

解决方案

Remove --warnings from .rspec. The generator in rspec 3.0.0 included this setting, but we've realized it was a mistake -- while it's good to encourage users to write warning-free code, it's confusing for users to get these warnings without being sure why.

For more info:

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

这篇关于Rspec /水豚正在加载,通报要求认为有害的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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