class Quails::Rack::LoggerTest

Constants

Subscriber

Attributes

notifier[R]
subscriber[R]

Public Instance Methods

setup() click to toggle source
# File railties/test/rack_logger_test.rb, line 41
def setup
  @subscriber = Subscriber.new
  @notifier = ActiveSupport::Notifications.notifier
  @subscription = notifier.subscribe "request.action_dispatch", subscriber
end
teardown() click to toggle source
# File railties/test/rack_logger_test.rb, line 47
def teardown
  notifier.unsubscribe @subscription
end
test_notification() click to toggle source
# File railties/test/rack_logger_test.rb, line 51
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() click to toggle source
# File railties/test/rack_logger_test.rb, line 61
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