A
A
alex_bel2013-08-08 16:37:12
Ruby on Rails
alex_bel, 2013-08-08 16:37:12

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

2 answer(s)
I
ivalkeen, 2013-08-15
@alex_bel

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

I
Ilya Sevostyanov, 2013-08-09
@RUVATA

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 .

Don't you think these are mutually exclusive paragraphs .
Try to reformulate the question, personally I did not understand what you want.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question