diff options
author | John Keiser <john@johnkeiser.com> | 2015-05-09 11:24:59 -0700 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2015-06-02 09:53:41 -0700 |
commit | 1afea6b5761cf10332397b5e3f7a7350356ad3f7 (patch) | |
tree | cd26456776a26bba601c67b37eeffe1a9dcd1501 /spec/unit | |
parent | 6278cb8adb09d51265172638d1f938ba8e346139 (diff) | |
download | chef-1afea6b5761cf10332397b5e3f7a7350356ad3f7.tar.gz |
Clean up match code to get rid of TODO
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/node_map_spec.rb | 5 | ||||
-rw-r--r-- | spec/unit/platform_spec.rb | 23 | ||||
-rw-r--r-- | spec/unit/recipe_spec.rb | 16 | ||||
-rw-r--r-- | spec/unit/resource_spec.rb | 2 |
4 files changed, 15 insertions, 31 deletions
diff --git a/spec/unit/node_map_spec.rb b/spec/unit/node_map_spec.rb index fe7372961b..9b5ff5e8c6 100644 --- a/spec/unit/node_map_spec.rb +++ b/spec/unit/node_map_spec.rb @@ -134,6 +134,10 @@ describe Chef::NodeMap do end describe "resource back-compat testing" do + before :each do + Chef::Config[:treat_deprecation_warnings_as_errors] = false + end + it "should handle :on_platforms => :all" do node_map.set(:chef_gem, :foo, :on_platforms => :all) allow(node).to receive(:[]).with(:platform).and_return("windows") @@ -152,4 +156,3 @@ describe Chef::NodeMap do end end - diff --git a/spec/unit/platform_spec.rb b/spec/unit/platform_spec.rb index 0a4e9655d0..36325d5411 100644 --- a/spec/unit/platform_spec.rb +++ b/spec/unit/platform_spec.rb @@ -18,29 +18,6 @@ require 'spec_helper' -describe "Chef::Platform supports" do - [ - :freebsd, - :ubuntu, - :debian, - :centos, - :fedora, - :suse, - :opensuse, - :redhat, - :oracle, - :gentoo, - :arch, - :solaris, - :gcel, - :ibm_powerkvm - ].each do |platform| - it "#{platform}" do - expect(Chef::Platform.platforms).to have_key(platform) - end - end -end - describe Chef::Platform do context "while testing with fake data" do diff --git a/spec/unit/recipe_spec.rb b/spec/unit/recipe_spec.rb index a4c0af882f..618c742998 100644 --- a/spec/unit/recipe_spec.rb +++ b/spec/unit/recipe_spec.rb @@ -122,7 +122,7 @@ describe Chef::Recipe do it "locate resource for particular platform" do ShaunTheSheep = Class.new(Chef::Resource) ShaunTheSheep.use_automatic_resource_name - ShaunTheSheep.provides :laughter, :on_platforms => ["television"] + ShaunTheSheep.provides :laughter, :platform => ["television"] node.automatic[:platform] = "television" node.automatic[:platform_version] = "123" res = recipe.laughter "timmy" @@ -144,10 +144,8 @@ describe Chef::Recipe do node.automatic[:platform] = "nbc_sports" Sounders = Class.new(Chef::Resource) Sounders.use_automatic_resource_name - Sounders.provides :football, platform: "nbc_sports" TottenhamHotspur = Class.new(Chef::Resource) TottenhamHotspur.use_automatic_resource_name - TottenhamHotspur.provides :football, platform: "nbc_sports" end after do @@ -155,9 +153,12 @@ describe Chef::Recipe do Object.send(:remove_const, :TottenhamHotspur) end - it "selects one if it is given priority" do + it "selects one if it is the last declared" do expect(Chef::Log).not_to receive(:warn) - Chef::Platform::ResourcePriorityMap.instance.send(:priority, :football, TottenhamHotspur, platform: "nbc_sports") + + Sounders.provides :football, platform: "nbc_sports" + TottenhamHotspur.provides :football, platform: "nbc_sports" + res1 = recipe.football "club world cup" expect(res1.name).to eql("club world cup") expect(res1).to be_a_kind_of(TottenhamHotspur) @@ -165,7 +166,10 @@ describe Chef::Recipe do it "selects the other one if it is given priority" do expect(Chef::Log).not_to receive(:warn) - Chef::Platform::ResourcePriorityMap.instance.send(:priority, :football, Sounders, platform: "nbc_sports") + + TottenhamHotspur.provides :football, platform: "nbc_sports" + Sounders.provides :football, platform: "nbc_sports" + res1 = recipe.football "club world cup" expect(res1.name).to eql("club world cup") expect(res1).to be_a_kind_of(Sounders) diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index 95de09f5ce..1d20fcf604 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -864,7 +864,7 @@ describe Chef::Resource do @node.name("bumblebee") @node.automatic[:platform] = "autobots" @node.automatic[:platform_version] = "6.1" - klz2.provides :dinobot, :on_platforms => ['autobots'] + klz2.provides :dinobot, :platform => ['autobots'] Object.const_set('Grimlock', klz2) klz2.provides :grimlock end |