Sha256: 9672f88fef78718520fc23169ae7c02dcf48d33c6773b978c5eae9eb30aa23f6

Contents?: true

Size: 892 Bytes

Versions: 5

Compression:

Stored size: 892 Bytes

Contents

require_relative "../../test_helper"

module Unit
  module Connection
    class TestLogger < MiniTest::Test

      class Connection < SimpleConnection
        include Clickhouse::Connection::Logger
      end

      describe Clickhouse::Connection::Logger do
        before do
          @connection = Connection.new
        end

        describe "#log" do
          describe "when having specified a logger" do
            it "delegates to logger" do
              (logger = mock).expects(:info, "Hello world!")
              Clickhouse.expects(:logger).returns(logger).twice
              @connection.send(:log, :info, "Hello world!")
            end
          end

          describe "when not having specified a logger" do
            it "does nothing" do
              assert_nil @connection.send(:log, :info, "Boo!")
            end
          end
        end
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
clickhouse-0.1.4 test/unit/connection/test_logger.rb
clickhouse-0.1.3 test/unit/connection/test_logger.rb
clickhouse-0.1.2 test/unit/connection/test_logger.rb
clickhouse-0.1.1 test/unit/connection/test_logger.rb
clickhouse-0.1.0 test/unit/connection/test_logger.rb