Sha256: e97a337e37b0f9265207cbf05bcadb405b57cb759b44118f8d9545deb31e520d

Contents?: true

Size: 1.23 KB

Versions: 6

Compression:

Stored size: 1.23 KB

Contents

#!/usr/bin/env ruby

require File.dirname(__FILE__) + '/../../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 '%s' messages" % log 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

6 entries across 6 versions & 1 rubygems

Version Path
puppet-0.25.5 spec/unit/util/warnings.rb
puppet-0.25.4 spec/unit/util/warnings.rb
puppet-0.25.3 spec/unit/util/warnings.rb
puppet-0.25.2 spec/unit/util/warnings.rb
puppet-0.25.1 spec/unit/util/warnings.rb
puppet-0.25.0 spec/unit/util/warnings.rb