diff options
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/caching_test.rb | 14 | ||||
-rw-r--r-- | actionpack/test/controller/logging_test.rb | 2 |
2 files changed, 7 insertions, 9 deletions
diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb index 679eaf7b38..54d1a72f1f 100644 --- a/actionpack/test/controller/caching_test.rb +++ b/actionpack/test/controller/caching_test.rb @@ -630,17 +630,15 @@ class FragmentCachingTest < ActionController::TestCase end def test_fragment_for_logging - fragment_computed = false - events = [] - ActiveSupport::Notifications.subscribe { |*args| events << args } + @controller.logger = MockLogger.new - buffer = 'generated till now -> ' - @controller.fragment_for(buffer, 'expensive') { fragment_computed = true } + fragment_computed = false + @controller.fragment_for('buffer', 'expensive') { fragment_computed = true } + ActiveSupport::Notifications.notifier.wait assert fragment_computed - assert_equal 'generated till now -> ', buffer - ActiveSupport::Notifications.notifier.wait - assert_equal [:exist_fragment?, :write_fragment], events.map(&:first) + assert_match /Exist fragment\? "views\/expensive"/, @controller.logger.logged[0] + assert_match /Write fragment "views\/expensive"/, @controller.logger.logged[1] end end diff --git a/actionpack/test/controller/logging_test.rb b/actionpack/test/controller/logging_test.rb index 4206dffa7e..6b9db88d83 100644 --- a/actionpack/test/controller/logging_test.rb +++ b/actionpack/test/controller/logging_test.rb @@ -75,6 +75,6 @@ class LoggingTest < ActionController::TestCase end def logs - @logs ||= @controller.logger.logged.compact.map {|l| l.to_s.strip} + @logs ||= @controller.logger.logged end end |