10

I am testing a rails 4.1.0 application with rspec-rails 3.0.1. rspec command is printing a large number of warnings about the gems I am using in the application. I have included a part of the output below. I want to know whether is it possible to suppress this.

/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
Indika K
  • 1,332
  • 17
  • 27

1 Answers1

17

removing --warnings option from your .rspec file would do the trick

Guard with RSpec on Rails 4 giving a lot of warnings

Community
  • 1
  • 1
tkymtk
  • 2,695
  • 3
  • 21
  • 37
  • Thanks. It did work. Can I assume this does not remove any error messages for the code that I am testing. – Indika K Jul 19 '14 at 06:01
  • 1
    Disabling warnings should be an exception, not the standard solution! – schmijos Jul 24 '14 at 06:46
  • @JosuaSchmid I would appreciate it if you would post the standard solution. – tkymtk Jul 24 '14 at 08:22
  • @tkymtk No, I shouldn't post a standard solution. That would not be an answer to the question. But your post is a correct one. Nevertheless it's worth mentioning risks of a solution. – schmijos Jul 24 '14 at 09:55
  • 3
    Actually, the rspec maintainers recommend removing this option from your rpsec file. https://github.com/rspec/rspec-core/issues/1571 However they do also recommend setting warnings in your config. – Rimian Sep 09 '14 at 00:19