diff options
Diffstat (limited to 'spec/unit')
-rwxr-xr-x | spec/unit/file_serving/configuration.rb | 2 | ||||
-rwxr-xr-x | spec/unit/util/warnings.rb | 38 |
2 files changed, 22 insertions, 18 deletions
diff --git a/spec/unit/file_serving/configuration.rb b/spec/unit/file_serving/configuration.rb index c2f386f14..f6acfad39 100755 --- a/spec/unit/file_serving/configuration.rb +++ b/spec/unit/file_serving/configuration.rb @@ -140,7 +140,7 @@ describe Puppet::FileServing::Configuration do mount = mock 'mount' config.stubs(:mounts).returns("modules" => mount) - Puppet::Util::Warnings.expects(:warnonce) + Puppet::Util::Warnings.expects(:notice_once) config.find_mount("foo", env).should equal(mount) end diff --git a/spec/unit/util/warnings.rb b/spec/unit/util/warnings.rb index 46bd1cc2d..15785cf58 100755 --- a/spec/unit/util/warnings.rb +++ b/spec/unit/util/warnings.rb @@ -2,31 +2,35 @@ require File.dirname(__FILE__) + '/../../spec_helper' -describe Puppet::Util::Warnings, " when registering a warning message" do +describe Puppet::Util::Warnings do before(:all) do @msg1 = "booness" @msg2 = "more booness" end - it "should always return nil" do - Puppet::Util::Warnings.warnonce(@msg1).should be(nil) - 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(:warning).with(@msg1) - Puppet::Util::Warnings.warnonce(@msg1) - 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(:warning).with(@msg1).once - Puppet::Util::Warnings.warnonce(@msg1) - Puppet::Util::Warnings.warnonce(@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(:warning).times(2) - Puppet::Util::Warnings.warnonce(@msg1) - Puppet::Util::Warnings.warnonce(@msg2) + 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 |