ruby-on-rails – Rspec rails打印许多警告

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – Rspec rails打印许多警告前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用rspec-rails 3.0.1测试rails 4.1.0应用程序. rspec命令正在打印关于我在应用程序中使用的宝石的大量警告.我已经列出了下面的一部分输出.我想知道是否可以压制这个.
/home/indika/Documents/rails/news_app/config/initializers/kramdown.rb:6: warning: method redefined; discarding old convert_img
/home/indika/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/kramdown-1.4.0/lib/kramdown/converter/html.rb:259: warning: prevIoUs definition of convert_img was here
/home/indika/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/mail-2.5.4/lib/mail/network/delivery_methods/sendmail.rb:53: warning: shadowing outer local variable - to
/home/indika/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/factory_girl-4.4.0/lib/factory_girl/find_definitions.rb:16: warning: File.exists? is a deprecated name,use File.exist? instead
/home/indika/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/factory_girl-4.4.0/lib/factory_girl/find_definitions.rb:16: warning: File.exists? is a deprecated name,use File.exist? instead
/home/indika/Documents/rails/news_app/spec/factories/news_articles.rb:1: warning: method redefined; discarding old ruby_iterator_code
/home/indika/Documents/rails/news_app/spec/factories/news_articles.rb:1: warning: prevIoUs definition of ruby_iterator_code was here
/home/indika/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/database_cleaner-1.3.0/lib/database_cleaner/configuration.rb:45: warning: instance variable @cleaners not initialized
/home/indika/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rouge-1.5.1/lib/rouge/regex_lexer.rb:136: warning: instance variable @loaded not initialized
/home/indika/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rouge-1.5.1/lib/rouge/regex_lexer.rb:136: warning: instance variable @loaded not initialized
/home/indika/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rouge-1.5.1/lib/rouge/regex_lexer.rb:136: warning: instance variable @loaded not initialized
/home/indika/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/kramdown-1.4.0/lib/kramdown/parser/kramdown/link.rb:18: warning: character class has duplicated range: /[\s\n]+/
/home/indika/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rouge-1.5.1/lib/rouge/regex_lexer.rb:136: warning: instance variable @loaded not initialized
/home/indika/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/capybara-2.4.1/lib/capybara/queries/text_query.rb:26: warning: instance variable @type not initialized
/home/indika/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/capybara-2.4.1/lib/capybara/queries/text_query.rb:26: warning: instance variable @type not initialized
/home/indika/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/capybara-2.4.1/lib/capybara/queries/text_query.rb:26: warning: instance variable @type not initialized
/home/indika/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/capybara-2.4.1/lib/capybara/queries/text_query.rb:26: warning: instance variable @type not initialized
./home/indika/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/capybara-2.4.1/lib/capybara/queries/text_query.rb:26: warning: instance variable @type not initialized
/home/indika/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/capybara-2.4.1/lib/capybara/queries/text_query.rb:26: warning: instance variable @type not initialized
.

Finished in 0.55369 seconds (files took 4.56 seconds to load)
2 examples,0 failures

解决方法

从.rspec文件删除–warnings选项将会做到这一点

Guard with RSpec on Rails 4 giving a lot of warnings

猜你在找的Ruby相关文章