如何停止 RSpec 警告消息 [英] How to Stop RSpec Warning Messages

查看:32
本文介绍了如何停止 RSpec 警告消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始学习在我的 rails 应用程序中使用 RSpec.看起来一切正常,但是当我运行 rspec spec 时,我得到了我认为是 lint 消息的页面和页面.

I have just started learning to use RSpec on my rails application. It all seems to work ok, but when I run rspec spec I get pages and pages of what I think are lint messages.

我不介意引用我的代码的那些,但很多引用我正在使用的 Gems.我真的无法解决这些问题.

I don't mind the ones that refer to my code, but lots of them refer to Gems that I am using. I can't really fix those.

如何将 RSpec 配置为仅将 lint 应用于我的代码而不是外部 Gems?

How can I configure RSpec to apply lint only to my code and not external Gems?

这是一个小样本.我得到了 2000 多行这些东西.

Here is a small sample. I get over 2000 lines of this stuff.

/Users/jcreasey/.rvm/gems/ruby-2.0.0-p0/gems/sorcery-0.8.5/lib/sorcery/model.rb:265: warning: method redefined; discarding old username_attribute_names=
/Users/jcreasey/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:251: warning: loading in progress, circular require considered harmful - /Users/jcreasey/.rvm/gems/ruby-2.0.0-p0/gems/sorcery-0.8.5/lib/sorcery.rb
    from /Users/jcreasey/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `<main>'
    from /Users/jcreasey/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `eval'
    from /Users/jcreasey/.rvm/gems/ruby-2.0.0-p0/bin/rspec:23:in `<main>'
    from /Users/jcreasey/.rvm/gems/ruby-2.0.0-p0/bin/rspec:23:in `load'
    from /Users/jcreasey/.rvm/gems/ruby-2.0.0-p0/gems/rspec-core-3.0.0/exe/rspec:4:in `<top (required)>'
    from /Users/jcreasey

这是我的 .rspec 文件

This is my .rspec file

-color
--warnings
--require spec_helper

推荐答案

如果您有 /.rspec 文件,请从其中删除 --warning 选项.

If you have /.rspec file remove --warning option from it.

这篇关于如何停止 RSpec 警告消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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