Guard with RSpec on Rails 4 giving a lot of warnings
The rspec generator rails generate rspec:install
now puts the --warnings
option in the .rspec
file by default. Remove that line, and the warnings will go away.
Rspec rails printing lot of warnings
removing --warnings
option from your .rspec
file would do the trick
Guard with RSpec on Rails 4 giving a lot of warnings
Too many warnings about 'circular require' when run rspec
I had same error and fixed it refs the page.
Guard with RSpec on Rails 4 giving a lot of warnings
the
--warnings
option in the .rspec file by default. Remove that line, and the warnings will go away.
deprecation errors when running rspec tests after updating to rails 5.0.0
The warnings were caused by the wicked_pdf
gem, updating to version 1.1.0
solved the issue
Suppress Ruby warnings when running specs
If you run your specs directly with the ruby command instead of the spec wrapper, you can use the -W command line option to silence warnings:
$ ruby --help
[...]
-W[level] set warning level; 0=silence, 1=medium, 2=verbose (default)
So in your case:
$ ruby -W0 -Ispec spec/models/event_spec.rb
should not show you any warnings.
Alternatively, you could set $VERBOSE=nil before your gems are loaded, ie at the top of your environment.rb (or application.rb if you're on Rails 3). Note that this disables all warnings all the time.
Or, since you are using Rails, you should be able to use Kernel.silence_warnings around the Bundler.require block if you're using Bundler:
Kernel.silence_warnings do
Bundler.require(:default, Rails.env) if defined?(Bundler)
end
More selectively, set $VERBOSE only for loading specific gems:
config.gem 'wellbehaving_gem'
original_verbosity = $VERBOSE
$VERBOSE = nil
config.gem 'noisy_gem_a'
$VERBOSE = original_verbosity
Rspec check if a block is yield with correct arguments
You can use a block implementation to call the passed block yourself in order to inspect its result:
expect(Parse).to receive(:publish_status).with(order.deliverer_id).once do |&block|
result = block.call
expect(result).to be_a(Hash)
expect(result[:status]).to eq('ready')
# ...
end
Rspec/Capybara loading in progress, circular require considered harmful
Remove --warnings
from .rspec
. The generator in rspec 3.0.0 included this setting, but we've realized it was a mistake -- while it's good to encourage users to write warning-free code, it's confusing for users to get these warnings without being sure why.
For more info:
https://github.com/rspec/rspec-core/issues/1571
How to Stop RSpec Warning Messages
If you have /.rspec
file remove --warning
option from it.
Related Topics
How to Print Out the Contents of an Object in Rails for Easy Debugging
Installing Ruby on MAC Os X 10.8.2
How to Use Bundler with Offline .Gem File
Using Ruby Convert Numbers to Words
Get Index of String Scan Results in Ruby
What's the Point of Unary Plus Operator in Ruby
How to Get Sinatra to Auto-Reload the File After Each Change
Using Factory_Girl in Rails with Associations That Have Unique Constraints. Getting Duplicate Errors
What's the Difference Between Gem_Home and Gem_Path
How to Reference a Function in Ruby
Ruby on Rails - "Add 'Gem SQLite3'' to Your Gemfile"
Set Utf-8 as Default for Ruby 1.9.3
Problems Installing Ruby on Mountain Lion - Ruby 1.9.3 Wont' Compile
Call Controller from Rake Task
How to Install Ruby 2 on Ubuntu Without Rvm
How to Get Readline Support in Irb Using Rvm on Ubuntu 11.10