summaryrefslogtreecommitdiff
path: root/test/unit/logging_responder_test.rb
blob: bb6c4a0fc70059f14c748f93d3c8010a5202e0a5 (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
30
31
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