Sha256: 211a3f90dca1a1243521236d7d4e95f71f30ed288ef691283e4d39fb560bdf1e

Contents?: true

Size: 1.21 KB

Versions: 5

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'
require 'singleton'

describe Enceladus::Logger, logger_test: true do
  let(:logger) { Enceladus::Logger.instance }

  around do |example|
    Singleton.__init__(Enceladus::Logger)
    example.run
    Singleton.__init__(Enceladus::Logger)
  end

  describe "#new" do
    it "should set log level to ERROR" do
      expect(logger.level).to eq(Enceladus::Logger::ERROR)
    end
  end

  describe ".logger_output=" do
    subject { Enceladus::Logger.logger_output = output }
    let(:output) { "enceladus.log" }

    it "sets the logger output to the one provided" do
      expect{ subject }.to change{ Enceladus::Logger.logger_output }.to(output)
    end
  end

  describe "#enable_debug_mode!" do
    subject { logger.enable_debug_mode! }
    before { logger.level = Enceladus::Logger::FATAL }

    it "should set the logger level to DEBUG" do
      expect{ subject }.to change{ logger.level }.to(Enceladus::Logger::DEBUG)
    end
  end

  describe "#disable_debug_mode!" do
    subject { logger.disable_debug_mode! }
    before { logger.level = Enceladus::Logger::FATAL }

    it "should set the logger level to ERROR" do
      expect{ subject }.to change{ logger.level }.to(Enceladus::Logger::ERROR)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
enceladus-0.0.8 spec/enceladus/logger_spec.rb
enceladus-0.0.7 spec/enceladus/logger_spec.rb
enceladus-0.0.6 spec/enceladus/logger_spec.rb
enceladus-0.0.5 spec/enceladus/logger_spec.rb
enceladus-0.0.4 spec/enceladus/logger_spec.rb