Sha256: 6acaf85c15cbe87b367fbf68ccbb9151328fa12662d80114c2c25220200b7bbb

Contents?: true

Size: 738 Bytes

Versions: 11

Compression:

Stored size: 738 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(:debug, '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
    Kernel.should_not_receive(:puts)
    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
      Kernel.should_not_receive(:puts)
      Qcmd.log_level.should eql(:warning)
      Qcmd.debug 'hello'
    end

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
qcmd-0.2.0 spec/unit/qcmd_spec.rb
qcmd-0.1.16 spec/unit/qcmd_spec.rb
qcmd-0.1.16.pre2 spec/unit/qcmd_spec.rb
qcmd-0.1.16.pre spec/unit/qcmd_spec.rb
qcmd-0.1.15 spec/unit/qcmd_spec.rb
qcmd-0.1.14 spec/unit/qcmd_spec.rb
qcmd-0.1.13 spec/unit/qcmd_spec.rb
qcmd-0.1.12 spec/unit/qcmd_spec.rb
qcmd-0.1.11 spec/unit/qcmd_spec.rb
qcmd-0.1.10 spec/unit/qcmd_spec.rb
qcmd-0.1.9 spec/unit/qcmd_spec.rb