如何在RSpectesting中打开ActiveRecord的SQLdebugging日志logging?
我有我的模型RSpectesting,我想打开SQL ActiveRecord日志logging,就像我在Rails服务器模式中看到的。 怎么做?
我开始我的testing
RAILS_ENV=test bundle exec rspec my/test_spec.rb 谢谢
 默认情况下,所有的db查询都将在testing模式下被logging。 他们将在log/test.log 。 
你可以尝试设置ActiveRecordlogging器在你的testing的地方标准输出。 如果你正在使用rspec,也许在规范助手?
 ActiveRecord::Base.logger = Logger.new(STDOUT) 
如果其他人的答案不起作用,请检查您的testing环境的“日志级别”。
它的默认值是'debug',它将输出由Rails生成的SQL。 如果它被设置为“info”,则SQL将会丢失。
组
 config.log_level = :info 
在testing环境中