Disable SQL logging in terminal during testing with Rails 3.1? (RSPEC/Cucumber)
I just upg开发者_如何学Goraded my app to rails 3.1 and now whenever I run tests I get a ton of SQL output in my terminal.
For example:
(1.0ms) TRUNCATE TABLE `users`;
(0.1ms) SET FOREIGN_KEY_CHECKS = 1
. Company Load (0.3ms) SELECT `companies`.* FROM `companies` LIMIT 1
Sector Load (0.3ms) SELECT `sectors`.* FROM `sectors` WHERE `sectors`.`name` = 'General' LIMIT 1
(0.1ms) BEGIN
(0.3ms) SELECT 1 FROM `sectors` WHERE `sectors`.`name` = BINARY 'General 63' LIMIT 1
SQL (0.2ms) INSERT INTO `sectors` (`created_at`, `name`, `price_in_cents`, `updated_at`) VALUES ('2011-09-13 20:46:48', 'General 63', 0, '2011-09-13 20:46:48')
(0.3ms) COMMIT
Is there any way to disable this?
I'm using rspec instafail and I can't seem them anymore because its flooded with SQL output.
I tried adding what was in this article but it didnt help: http://tesoriere.com/2011/05/28/rails-3.1---sql-logging-to-stdout-during-testing--with-rspec--test-unit--or-cucumber-/
Have you tried setting the config.log_level
in your environments/test.rb?
config.log_level = :error
That would be the easiest solution, unless there's a reason it's not working.
精彩评论