Sha256: 039659014c10719b0774b042e64f7a19952fb9d3e983e21a2aaae4f117aafbe8
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
# frozen_string_literal: true RSpec.describe TTY::Logger, 'levels' do it "fails when unknown level" do logger = TTY::Logger.new expect { logger.compare_levels(:error, :unknown) }.to raise_error(ArgumentError, "Invalid level :unknown") end it "compares names with equal level" do logger = TTY::Logger.new expect(logger.compare_levels(:info, :info)).to eq(:eq) end it "compares names with equal level" do logger = TTY::Logger.new expect(logger.compare_levels("INFO", "INFO")).to eq(:eq) end it "compares numbers with equal level" do logger = TTY::Logger.new expect(logger.compare_levels(TTY::Logger::INFO_LEVEL, TTY::Logger::INFO_LEVEL)).to eq(:eq) end it "compares names with lower level" do logger = TTY::Logger.new expect(logger.compare_levels(:debug, :warn)).to eq(:lt) end it "compares numbers with lower level" do logger = TTY::Logger.new expect(logger.compare_levels(TTY::Logger::DEBUG_LEVEL, TTY::Logger::WARN_LEVEL)).to eq(:lt) end it "compares names with greater level" do logger = TTY::Logger.new expect(logger.compare_levels(:error, :info)).to eq(:gt) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tty-logger-0.2.0 | spec/unit/levels_spec.rb |
tty-logger-0.1.0 | spec/unit/levels_spec.rb |