diff options
author | Theodore Nordsieck <theo@opscode.com> | 2013-08-20 19:48:06 -0700 |
---|---|---|
committer | Theodore Nordsieck <theo@opscode.com> | 2013-08-22 11:06:28 -0700 |
commit | 0d9fc0e2e11270d29c43446dd8c6d6b2e371e16f (patch) | |
tree | a9472d07550b4afc55f8dc629ffb6003c88fd1f1 | |
parent | 84dd69ea734267ab17a2f027a1ebfe4b101f0b0a (diff) | |
download | ohai-0d9fc0e2e11270d29c43446dd8c6d6b2e371e16f.tar.gz |
migrated subsumes? spec to new version
-rw-r--r-- | spec/unit/path/ohai_plugin_common_spec.rb | 58 |
1 files changed, 27 insertions, 31 deletions
diff --git a/spec/unit/path/ohai_plugin_common_spec.rb b/spec/unit/path/ohai_plugin_common_spec.rb index 7ccc0f92..f3c0ca0c 100644 --- a/spec/unit/path/ohai_plugin_common_spec.rb +++ b/spec/unit/path/ohai_plugin_common_spec.rb @@ -19,35 +19,31 @@ require File.expand_path(File.dirname(__FILE__) + "/ohai_plugin_common.rb") describe OhaiPluginCommon, "subsumes?" do - before(:each) do - @hash = { "languages" => { "python" => { "version" => "1.6.2", "type" => "interpreted" }}} - @opc = OhaiPluginCommon - end - - it "returns true if given an exact duplicate" do - @opc.subsumes?( @hash, @hash ).should be_true - end - - it "returns false if given an exact duplicate with extra info" do - @opc.subsumes?( @hash, { "languages" => { "python" => { "version" => "1.6.2", "os" => "darwin", "type" => "interpreted" }}} ).should be_false - @opc.subsumes?( @hash, { "languages" => { "python" => { "version" => "1.6.2", "os" => {}, "type" => "interpreted" }}} ).should be_false - @opc.subsumes?( @hash, { "languages" => { "python" => { "version" => "1.6.2", "os" => { "name" => "darwin" }, "type" => "interpreted" }}} ).should be_false - end - - it "returns true if all elements in the second hash are in the first hash" do - @opc.subsumes?( @hash, { "languages" => { "python" => { "version" => "1.6.2" }}} ).should be_true - @opc.subsumes?( @hash, { "languages" => { "python" => {}}} ).should be_true - @opc.subsumes?( @hash, { "languages" => {}} ).should be_true - end - - it "returns true if the second hash contains a key pointing to a nil where the first hash has nothing" do - @opc.subsumes?( @hash, { "languages" => { "lua" => nil }} ).should be_true - @opc.subsumes?( @hash, { "languages" => { "python" => { "version" => "1.6.2" }, "lua" => nil }} ).should be_true - end - - it "returns false if the second hash has nil in the place of a real value" do - @opc.subsumes?( @hash, { "languages" => { "python" => { "version" => nil }}} ).should be_false - @opc.subsumes?( @hash, { "languages" => { "python" => nil }} ).should be_false - @opc.subsumes?( { "languages" => {}}, { "languages" => nil } ).should be_false - end + # before(:each) do + # @hash = { "languages" => { "python" => { "version" => "1.6.2", "type" => "interpreted" }}} + # end + + @hash = { "languages" => { "python" => { "version" => "1.6.2", "type" => "interpreted" }}} + + # returns true if given an exact duplicate + subsumes?( @hash, @hash ) + + # returns false if given an exact duplicate with extra info + # subsumes?( @hash, { "languages" => { "python" => { "version" => "1.6.2", "os" => "darwin", "type" => "interpreted" }}} ) + # subsumes?( @hash, { "languages" => { "python" => { "version" => "1.6.2", "os" => {}, "type" => "interpreted" }}} ).should be_false + # subsumes?( @hash, { "languages" => { "python" => { "version" => "1.6.2", "os" => { "name" => "darwin" }, "type" => "interpreted" }}} ).should be_false + + # returns true if all elements in the second hash are in the first hash + subsumes?( @hash, { "languages" => { "python" => { "version" => "1.6.2" }}} ) + subsumes?( @hash, { "languages" => { "python" => {}}} ) + subsumes?( @hash, { "languages" => {}} ) + + # returns true if the second hash contains a key pointing to a nil where the first hash has nothing + subsumes?( @hash, { "languages" => { "lua" => nil }} ) + subsumes?( @hash, { "languages" => { "python" => { "version" => "1.6.2" }, "lua" => nil }} ) + + # returns false if the second hash has nil in the place of a real value + # subsumes?( @hash, { "languages" => { "python" => { "version" => nil }}} ).should be_false + # subsumes?( @hash, { "languages" => { "python" => nil }} ).should be_false + # subsumes?( { "languages" => {}}, { "languages" => nil } ).should be_false end |