7

I just upgraded 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-/

1

1 Answer 1

13

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.