Sha256: d7a4721da916c52463b48b0665a22a3cf711587f427fdb27e58af44ffc597c01

Contents?: true

Size: 724 Bytes

Versions: 2

Compression:

Stored size: 724 Bytes

Contents

require 'qcmd'

describe Qcmd do
  # tests go here
  it "should log debug messages when in verbose mode" do
    Qcmd.should_receive(:log).with('hello')
    Qcmd.verbose!
    Qcmd.log_level.should eql(:debug)
    Qcmd.debug 'hello'
  end

  it 'should not log debug messages when not in verbose mode' do
    Qcmd.should_not_receive(:log)
    Qcmd.quiet!
    Qcmd.log_level.should eql(:warning)
    Qcmd.debug 'hello'
  end

  it 'should not log debug messages when in quiet block' do
    Qcmd.verbose!
    Qcmd.log_level.should eql(:debug)

    Qcmd.while_quiet do
      Qcmd.should_not_receive(:log)
      Qcmd.log_level.should eql(:warning)
      Qcmd.debug 'hello'
    end

    Qcmd.log_level.should eql(:debug)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qcmd-0.1.8 spec/unit/qcmd_spec.rb
qcmd-0.1.7 spec/unit/qcmd_spec.rb