Namespace
Methods
S
T
Attributes
[R] notifier
[R] subscriber
Instance Public methods
setup()
# File railties/test/rack_logger_test.rb, line 39
def setup
  @subscriber = Subscriber.new
  @notifier = ActiveSupport::Notifications.notifier
  @subscription = notifier.subscribe 'request.action_dispatch', subscriber
end
teardown()
# File railties/test/rack_logger_test.rb, line 45
def teardown
  notifier.unsubscribe @subscription
end
test_notification()
# File railties/test/rack_logger_test.rb, line 49
def test_notification
  logger = TestLogger.new { }

  assert_difference('subscriber.starts.length') do
    assert_difference('subscriber.finishes.length') do
      logger.call('REQUEST_METHOD' => 'GET').last.close
    end
  end
end
test_notification_on_raise()
# File railties/test/rack_logger_test.rb, line 59
def test_notification_on_raise
  logger = TestLogger.new do
    # using an exception class that is not a StandardError subclass on purpose
    raise NotImplementedError
  end

  assert_difference('subscriber.starts.length') do
    assert_difference('subscriber.finishes.length') do
      assert_raises(NotImplementedError) do
        logger.call 'REQUEST_METHOD' => 'GET'
      end
    end
  end
end