diff options
author | danielsdeleo <dan@getchef.com> | 2014-04-23 14:03:44 -0700 |
---|---|---|
committer | danielsdeleo <dan@getchef.com> | 2014-04-24 09:49:52 -0700 |
commit | 6d95ac36a84a733a8a0b85632ecf6fc112698d26 (patch) | |
tree | 4d4a380cc25f939082df4b541b2e376b6b9ed3b4 /spec | |
parent | d379d9bad563be55ea45340a24b394d98d45f971 (diff) | |
download | chef-6d95ac36a84a733a8a0b85632ecf6fc112698d26.tar.gz |
Silence warnings when testing deprecated APIs
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/node/attribute_spec.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/spec/unit/node/attribute_spec.rb b/spec/unit/node/attribute_spec.rb index bab2e33aa9..5325117d6c 100644 --- a/spec/unit/node/attribute_spec.rb +++ b/spec/unit/node/attribute_spec.rb @@ -890,6 +890,15 @@ describe Chef::Node::Attribute do end describe "index" do + # Hash#index is deprecated and triggers warnings. + def silence + old_verbose = $VERBOSE + $VERBOSE = nil + yield + ensure + $VERBOSE = old_verbose + end + before do @attributes = Chef::Node::Attribute.new( { @@ -914,13 +923,17 @@ describe Chef::Node::Attribute do describe "when the value is indexed" do it "should return the index" do - @attributes.index("six").should == "one" + silence do + @attributes.index("six").should == "one" + end end end describe "when the value is not indexed" do it "should return nil" do - @attributes.index("lolol").should == nil + silence do + @attributes.index("lolol").should == nil + end end end |