Sha256: e40b7b1df07c7badeccffddb9a1cee6366706170043d4fd27d39e7229d269177

Contents?: true

Size: 1.07 KB

Versions: 71

Compression:

Stored size: 1.07 KB

Contents

#! /usr/bin/env ruby
require 'spec_helper'

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

  {:notice => "notice_once", :warning => "warnonce", :debug => "debug_once"}.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

71 entries across 71 versions & 1 rubygems

Version Path
puppet-3.4.0 spec/unit/util/warnings_spec.rb
puppet-3.4.0.rc2 spec/unit/util/warnings_spec.rb
puppet-3.4.0.rc1 spec/unit/util/warnings_spec.rb
puppet-3.3.2 spec/unit/util/warnings_spec.rb
puppet-3.3.1 spec/unit/util/warnings_spec.rb
puppet-3.3.1.rc3 spec/unit/util/warnings_spec.rb
puppet-3.3.1.rc2 spec/unit/util/warnings_spec.rb
puppet-3.3.1.rc1 spec/unit/util/warnings_spec.rb
puppet-3.3.0 spec/unit/util/warnings_spec.rb
puppet-3.3.0.rc3 spec/unit/util/warnings_spec.rb
puppet-3.3.0.rc2 spec/unit/util/warnings_spec.rb