Ruby on Rails: teste de presença de saída de logs em Rails.logger (por meio de Minitest também)

require ‘test_helper’class MyTest < ActionDispatch::IntegrationTest def with_logger_introspection(&block) orig_logger = Rails.logger.dup @logger_output = StringIO.new begin Rails.logger = ActiveSupport::Logger.new(@logger_output) block.call(@logger_output) ensure Rails.logger = orig_logger end end test “Something is logged” do with_logger_introspection …

Continuar lendo