Answer the question
In order to leave comments, you need to log in
Change logging level for one test (rspec)
To speed up the tests a little, I increased the logging level: I added it to spec_helper.rb
Rails.logger.level = 4
Everything is great. But I would like to see a normal log output for each individual test case, i.e. you need to lower the logging level.
Can't think of a way to do this?
I run a separate test like this:
rspec spec/model/user_spec.rb -l 15
Answer the question
In order to leave comments, you need to log in
You can read the level from the environment variable in the helper, something like this:
Rails.logger.level = (ENV['LEVEL'] || 4).to_i
and then call a specific test specifying the desired value, something like this:
LEVEL=0 rspec spec/model/user_spec.rb -l 15
To speed up the tests a bit, I increased the logging level : added
Rails.logger.level = 4 to spec_helper.rb
Everything is fine. But I would like to see a normal log output for each individual test case, i.e. You need to lower the logging level .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question