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.



8
9
10
# File 'activesupport/lib/active_support/testing/tagged_logging.rb', line 8

def tagged_logger=(value)
  @tagged_logger = value
end

Instance Method Details

#before_setupObject



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

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