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:
DEPRECATION WARNING: ActiveSupport::Dependencies.load_paths is deprecated, ... warning: already initialized constant SOME_CONSTANT_NAME
Removing the ActiveSupport
warning is quite easy with ActiveSupport::Deprecation.silenced = true
.
How do I prevent the already initialized constant warnings as part of my spec
command? Or through creating another spec
file that can suppress such warnings. Keep in mind that these warnings are from gem files, therefore I cannot go into those files and surround them with Kernel.silence_warnings
.
Note: I understand that suppressing warnings are bad. However, when I run a single spec
from within vim
it would be nice if the warnings didn't clutter my screen.
The syntax for RUBYOPT
is
RUBYOPT="-W0" rspec
Tested in ruby 2.1.x and 2.14.x
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With