Sha256: 8a9def0874c1a88e1f1d7982a7ef7a66a8feca8dad76056d2fc64cb038b6599c

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

module Yarn

  class TestLoggging
    include Logging
  end

  describe Logging do

    describe "#log" do
      it "should make the logging methods available" do
        @server = Server.new(output: $output, debug: true)
        @server.should respond_to(:log)
        @server.should respond_to(:debug)
        @server.stop
      end

      it "should be available in the handler classes" do
        @handler = RequestHandler.new

        @handler.should respond_to(:log)
        @handler.should respond_to(:debug)
      end

      it "should send the message to output" do
        test_logger = TestLoggging.new
        test_logger.output.should_receive(:puts).once

        test_logger.log "testing"
      end

      it "should handles arrays" do
        test_logger = TestLoggging.new
        test_logger.output.should_receive(:puts).twice

        test_logger.log [1,2]
      end

    end

    describe "#debug" do
      it "should invoke the log method with a message" do
        $debug = true
        test_logger = TestLoggging.new
        test_logger.should_receive(:log).with("DEBUG: testing").once

        test_logger.debug "testing"
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yarn-0.1.0 spec/yarn/logging_spec.rb
yarn-0.0.9 spec/yarn/logging_spec.rb
yarn-0.0.2 spec/yarn/logging_spec.rb