Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude external gem warnings when running rake test in Rails

I'm trying to set up a cloud9 (https://c9.io) test install of my Rails 3.2 app, so that new developers can quickly get it up and running for submitting changes and running tests. All my tests pass, but they're mixed in with many many warnings related to different gems:

Loaded suite /usr/local/rvm/gems/ruby-2.1.2/gems/rake-11.1.1/lib/rake/rake_test_loader
Started
......

Finished in 0.22973343 seconds.
------
6 tests, 10 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
0% passed
------
26.12 tests/s, 43.53 assertions/s
Loaded suite /usr/local/rvm/gems/ruby-2.1.2/gems/rake-11.1.1/lib/rake/rake_test_loader
Started
............................................

Finished in 4.18306875 seconds.
------
44 tests, 77 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
/usr/local/rvm/gems/ruby-2.1.2/gems/composite_primary_keys-5.0.14/lib/composite_primary_keys/relation.rb:26: warning: previous definition of destroy was here
/usr/local/rvm/gems/ruby-2.1.2/gems/composite_primary_keys-5.0.14/lib/composite_primary_keys/relation.rb:10: warning: method redefined; discarding old delete
/usr/local/rvm/gems/ruby-2.1.2/gems/composite_primary_keys-5.0.14/lib/composite_primary_keys/relation.rb:10: warning: previous definition of delete was here
/usr/local/rvm/gems/ruby-2.1.2/gems/composite_primary_keys-5.0.14/lib/composite_primary_keys/relation.rb:26: warning: method redefined; discarding old destroy

... it continues and generates warnings for lots of other gems.

On my own Ubuntu/Debian machines, I don't see these warnings, and they make it hard to see the test results that are now interspersed among dozens of other lines of warnings.

Is there a way to suppress the warnings or configure my tests so that they don't trigger this level of verbosity?

like image 329
jywarren Avatar asked Oct 19 '22 13:10

jywarren


1 Answers

There are a number of options for different environments here: Suppress Ruby warnings when running specs

I used RUBYOPT=W0 rake test and this worked on a (crouton, ARM) Ubuntu 14 system with RVM.

like image 134
jywarren Avatar answered Oct 21 '22 06:10

jywarren