Rspec导轨印刷了很多警告

时间:2014-07-19 02:34:04

标签: ruby-on-rails rspec-rails suppress-warnings

我正在使用rspec-rails 3.0.1测试rails 4.1.0应用程序。 rspec命令正在打印有关我在应用程序中使用的gem的大量警告。我在下面列出了一部分输出。我想知道是否有可能压制这个。

/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/.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

1 个答案:

答案 0 :(得分:16)

--warnings文件中删除.rspec选项可以解决问题

Guard with RSpec on Rails 4 giving a lot of warnings