Sha256: 19b0fa63c45e8dc656040896b4dfdf6a91eb885ab138e8e6fcc57e300577580b

Contents?: true

Size: 1.09 KB

Versions: 35

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

module Itamae
  describe Logger do
    describe "#debug" do
      context "`msg` is a String" do
        it "indents the message" do
          expect_any_instance_of(::Logger).to receive(:debug).with("  msg")
          Itamae.logger.with_indent do
            Itamae.logger.debug("msg")
          end
        end
      end

      context "`msg` is an Exception" do
        let(:msg) { ::Exception.new("error") }

        before do
          allow(msg).to receive(:backtrace) { %w!frame1 frame2! }
        end

        it "indents the error message and the backtrace" do
          expect_any_instance_of(::Logger).to receive(:debug).with(<<-MSG.rstrip)
  error (Exception)
  frame1
  frame2
          MSG
          Itamae.logger.with_indent do
            Itamae.logger.debug(msg)
          end
        end
      end

      context "`msg` is an Array" do
        it "indents the message" do
          expect_any_instance_of(::Logger).to receive(:debug).with("  []")
          Itamae.logger.with_indent do
            Itamae.logger.debug([])
          end
        end
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
itamae-1.14.1 spec/unit/lib/itamae/logger_spec.rb
itamae-1.14.0 spec/unit/lib/itamae/logger_spec.rb
itamae-1.13.1 spec/unit/lib/itamae/logger_spec.rb
itamae-1.13.0 spec/unit/lib/itamae/logger_spec.rb
itamae-1.12.6 spec/unit/lib/itamae/logger_spec.rb
itamae-1.12.5 spec/unit/lib/itamae/logger_spec.rb
itamae-1.12.4 spec/unit/lib/itamae/logger_spec.rb
itamae-1.12.3 spec/unit/lib/itamae/logger_spec.rb
itamae-1.12.2 spec/unit/lib/itamae/logger_spec.rb
itamae-1.12.1 spec/unit/lib/itamae/logger_spec.rb
itamae-1.12.0 spec/unit/lib/itamae/logger_spec.rb
itamae-1.11.2 spec/unit/lib/itamae/logger_spec.rb
itamae-1.11.1 spec/unit/lib/itamae/logger_spec.rb
itamae-1.11.0 spec/unit/lib/itamae/logger_spec.rb
itamae-1.10.10 spec/unit/lib/itamae/logger_spec.rb
itamae-1.10.9 spec/unit/lib/itamae/logger_spec.rb
itamae-1.10.8 spec/unit/lib/itamae/logger_spec.rb
itamae-1.10.7 spec/unit/lib/itamae/logger_spec.rb
itamae-1.10.6 spec/unit/lib/itamae/logger_spec.rb
itamae-1.10.5 spec/unit/lib/itamae/logger_spec.rb