summaryrefslogtreecommitdiff
path: root/test/unit/logging_responder_test.rb
blob: 9053860f4ab211b1d7ad49809c7b40c64a445f1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require 'test_helper'
require 'nickserver/logging_responder'

module Nickserver
  class LoggingResponderTest < Minitest::Test
    def test_responds_and_logs
      logger.expect :info, nil, [' -> 200']
      respond_to 200, 'body'
      logger.verify
    end

    protected

    def respond_to(*args)
      responder.expect :respond, nil, args
      logging_responder = LoggingResponder.new responder, logger
      logging_responder.respond(*args)
      responder.verify
    end

    def responder
      @responder ||= Minitest::Mock.new
    end

    def logger
      @logger ||= Minitest::Mock.new
    end
  end
end