运行我们的 rspec 测试套件时
bundle exec rspec spec/
日志中充斥着许多日志语句。特别是,控制器规范多次显示如下内容:
{"controller"=>"myController", "action"=>"create"}
我想摆脱这些,但找不到来源。没有匹配这样的 puts 语句,也没有任何 Rails.logger 调用。我假设这是一个日志级别的问题,但我可能是错的。在 environment/test.rb 中设置 config.log_level 无效。
当前的 rspec 配置如下所示
RSpec.configure do |config|
config.include Devise::TestHelpers, :type => :controller
config.mock_with :rspec
config.before(:suite) do
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.orm = "mongoid"
end
config.before(:each) do
DatabaseCleaner.clean
end
config.color_enabled = true
config.tty = true
config.formatter = :documentation # :progress, :html, :textmate
end
关于如何禁用这些类型的日志有什么想法吗?
旁注:Gemfile 正在使用 'rails'、'3.2.13' 和 'rspec-rails'、'2.14.0'