I\'m looking for a way to suppress Ruby warnings when I run my specs.
spec spec/models/account_spec.rb
I receive warnings such as:
Putting Warning[:deprecated] = false
after require "rails/all"
in config/application.rb
works very well to suppress those warnings everywhere. You can do
Warning[:deprecated] = false if Rails.env.test?
for your particular case, or better yet - put it in config/environments/test.rb
, but I'm not sure how well it is going to work since I belive some stuff is loaded before that.
You can also use the "RUBYOPT" environment variable to pass -W0 to rspec:
RUBYOPT=W0 rspec spec/models/event_spec.rb
This allows you to run multiple specs by passing in a directory
RUBYOPT=W0 rspec spec/models
The only solution that worked for me is to add $VERBOSE = nil
on top of my config/environments/test.rb file
Rails.application.configure do
$VERBOSE = nil
I'm with faker warning problems faker-1.9.6/lib/faker/default/number.rb:34
.
Use it local because it hides all other warnings.
rspec has a tag option you can use -- I simply used /dev/null.
rspec spec --deprecation-out /dev/null