summaryrefslogtreecommitdiffstats
path: root/spec/unit/util
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2011-04-12 13:13:30 -0700
committerNick Lewis <nick@puppetlabs.com>2011-04-12 13:13:30 -0700
commit2dfa0afb57ec80f451a54ef96341d413819c14c7 (patch)
tree228ce122f952d72b513562a1874f93624ce855fb /spec/unit/util
parent665fabdb3e468d1ef38d689b9cb0d75b9d788f88 (diff)
parente569f3baec68b9f53b37ac07984b7a858b155991 (diff)
Merge branch 'ticket/next/5027' into next
Diffstat (limited to 'spec/unit/util')
-rwxr-xr-xspec/unit/util/logging_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/unit/util/logging_spec.rb b/spec/unit/util/logging_spec.rb
index edc88f115..bc2eaff43 100755
--- a/spec/unit/util/logging_spec.rb
+++ b/spec/unit/util/logging_spec.rb
@@ -92,4 +92,29 @@ describe Puppet::Util::Logging do
end
end
end
+
+ describe "when sending a deprecation warning" do
+ before do
+ @logger.clear_deprecation_warnings
+ end
+
+ it "should the message with warn" do
+ @logger.expects(:warning).with('foo')
+ @logger.deprecation_warning 'foo'
+ end
+
+ it "should only log each unique message once" do
+ @logger.expects(:warning).with('foo').once
+ 5.times { @logger.deprecation_warning 'foo' }
+ end
+
+ it "should only log the first 100 messages" do
+ (1..100).each { |i|
+ @logger.expects(:warning).with(i).once
+ @logger.deprecation_warning i
+ }
+ @logger.expects(:warning).with(101).never
+ @logger.deprecation_warning 101
+ end
+ end
end