Module: ActiveSupport::Testing::TaggedLogging

Included in:
ActiveSupport::TestCase
Defined in:
activesupport/lib/active_support/testing/tagged_logging.rb

Overview

Logs a “PostsControllerTest: test name” heading before each test to make test.log easier to search and follow along with.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#tagged_logger=(value) ⇒ Object

Sets the attribute tagged_logger

Parameters:

  • value

    the value to set the attribute tagged_logger to.



6
7
8
# File 'activesupport/lib/active_support/testing/tagged_logging.rb', line 6

def tagged_logger=(value)
  @tagged_logger = value
end

Instance Method Details

#before_setupObject



8
9
10
11
12
13
14
15
16
17
# File 'activesupport/lib/active_support/testing/tagged_logging.rb', line 8

def before_setup
  if tagged_logger
    heading = "#{self.class}: #{name}"
    divider = '-' * heading.size
    tagged_logger.info divider
    tagged_logger.info heading
    tagged_logger.info divider
  end
  super
end