From 86ebe0bd36e03b7b7531d818f65cacdb03766abe Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 26 Sep 2012 11:16:43 -0700 Subject: Tests tag the Rails log with the current test class and test case --- activesupport/test/test_test.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'activesupport/test') diff --git a/activesupport/test/test_test.rb b/activesupport/test/test_test.rb index 2473cec384..d19aab1438 100644 --- a/activesupport/test/test_test.rb +++ b/activesupport/test/test_test.rb @@ -171,3 +171,18 @@ class SubclassSetupAndTeardownTest < SetupAndTeardownTest assert_equal [:foo, :bar, :bar, :foo], @called_back end end + + +class TestCaseTaggedLoggingTest < ActiveSupport::TestCase + def before_setup + require 'stringio' + @out = StringIO.new + self.tagged_logger = ActiveSupport::TaggedLogging.new(Logger.new(@out)) + super + end + + def test_logs_tagged_with_current_test_case + tagged_logger.info 'test' + assert_equal "[#{self.class.name}] [#{__name__}] test\n", @out.string + end +end -- cgit v1.2.3