diff options
author | Azul <azul@riseup.net> | 2016-09-30 11:59:20 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2016-09-30 11:59:20 +0200 |
commit | 8ee1d1cb70bee8c938966e4e042b4929ced8b1a3 (patch) | |
tree | 99d3a5c5ded96b84924b582f615d662536f5bb0a /test/unit | |
parent | 997af2eea91263b1d6c07e02a98f02f81a320acf (diff) |
logging: use proper logger
This way the logs do not interfere with test output
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/logging_responder_test.rb | 31 |
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 |