summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-10-06 19:06:21 -0500
committerJames Turnbull <james@lovedthanlost.net>2008-10-08 10:56:10 +1100
commit0b1e60f69a03e6525e1a9eefd748c59b4fc5261c (patch)
treeed1710bfd0b7f11d10c95196cb2a07f534782e55 /spec
parent765db307f875a52b7dec386b0af90f8e5b4590bb (diff)
downloadpuppet-0b1e60f69a03e6525e1a9eefd748c59b4fc5261c.tar.gz
puppet-0b1e60f69a03e6525e1a9eefd748c59b4fc5261c.tar.xz
puppet-0b1e60f69a03e6525e1a9eefd748c59b4fc5261c.zip
Adding an array indexer method to Puppet::Util::Metric as requested in #1633.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/util/metric.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/unit/util/metric.rb b/spec/unit/util/metric.rb
index 7aa04486c..3501aac90 100755
--- a/spec/unit/util/metric.rb
+++ b/spec/unit/util/metric.rb
@@ -75,6 +75,15 @@ describe Puppet::Util::Metric do
@metric.values.should == [[:bar, "a", 10], [:foo, "b", 10]]
end
+ it "should use an array indexer method to retrieve individual values" do
+ @metric.newvalue(:foo, 10)
+ @metric[:foo].should == 10
+ end
+
+ it "should return nil if the named value cannot be found" do
+ @metric[:foo].should be_nil
+ end
+
# LAK: I'm not taking the time to develop these tests right now.
# I expect they should actually be extracted into a separate class
# anyway.