How do I disable Rspec's detailed logging?
source link: https://www.codesd.com/item/how-do-i-disable-rspec-s-detailed-logging.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
How do I disable Rspec's detailed logging?
When running our rspec suite of tests
bundle exec rspec spec/
The logs are cluttered with far to many log statements. In particular, the controller specs show things like this multiple times:
{"controller"=>"myController", "action"=>"create"}
I would like to get rid of these but can't find the source. There are no puts statements which match anything like this nor are there any Rails.logger calls. I'm assuming this is a log level issue but I could be wrong. Setting config.log_level in environment/test.rb has no effect.
The current rspec configuration looks like this
RSpec.configure do |config|
config.include Devise::TestHelpers, :type => :controller
config.mock_with :rspec
config.before(:suite) do
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.orm = "mongoid"
end
config.before(:each) do
DatabaseCleaner.clean
end
config.color_enabled = true
config.tty = true
config.formatter = :documentation # :progress, :html, :textmate
end
Any thoughts on how I might disable these type of logs?
Side note: Gemfile is using 'rails', '3.2.13' and 'rspec-rails', '2.14.0'
In case someone comes across this same thread later on, I found that I had the same problem the author described, however, it came from having the Heroku rails_12factor
gem in my Gemfile.
Another user said that the gem was causing double output for them: Double console output?
As soon as I either commented it out or put it in the :production
group, all of the verbose SQL output in my console went away.
So just another thing to check if you have the same problem, but the author's solution isn't what fixes it for you.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK