From 8ee1d1cb70bee8c938966e4e042b4929ced8b1a3 Mon Sep 17 00:00:00 2001 From: Azul Date: Fri, 30 Sep 2016 11:59:20 +0200 Subject: logging: use proper logger This way the logs do not interfere with test output --- test/unit/logging_responder_test.rb | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 test/unit/logging_responder_test.rb (limited to 'test/unit') 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 -- cgit v1.2.3