Sha256: bcd77f1695730e9b94d1be2675dea206d1fed7c198a4e8dcb6b6f4c8839f0f86

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

#! /usr/bin/env ruby -S rspec
require 'spec_helper'

describe Puppet::Util::Warnings do
  before(:all) do
    @msg1 = "booness"
    @msg2 = "more booness"
  end

  {:notice => "notice_once", :warning => "warnonce"}.each do |log, method|
    describe "when registring '#{log}' messages" do
      it "should always return nil" do
        Puppet::Util::Warnings.send(method, @msg1).should be(nil)
      end

      it "should issue a warning" do
        Puppet.expects(log).with(@msg1)
        Puppet::Util::Warnings.send(method, @msg1)
      end

      it "should issue a warning exactly once per unique message" do
        Puppet.expects(log).with(@msg1).once
        Puppet::Util::Warnings.send(method, @msg1)
        Puppet::Util::Warnings.send(method, @msg1)
      end

      it "should issue multiple warnings for multiple unique messages" do
        Puppet.expects(log).times(2)
        Puppet::Util::Warnings.send(method, @msg1)
        Puppet::Util::Warnings.send(method, @msg2)
      end
    end
  end

  after(:each) do
    Puppet::Util::Warnings.clear_warnings
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
puppet-3.0.0.rc8 spec/unit/util/warnings_spec.rb
puppet-3.0.0.rc7 spec/unit/util/warnings_spec.rb
puppet-3.0.0.rc5 spec/unit/util/warnings_spec.rb
puppet-3.0.0.rc4 spec/unit/util/warnings_spec.rb