summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/unit/logging_responder_test.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/unit/logging_responder_test.rb b/test/unit/logging_responder_test.rb
new file mode 100644
index 0000000..411bc7e
--- /dev/null
+++ b/test/unit/logging_responder_test.rb
@@ -0,0 +1,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