summaryrefslogtreecommitdiff
path: root/spec/unit/recipe_spec.rb
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2015-05-09 11:24:59 -0700
committerJohn Keiser <john@johnkeiser.com>2015-06-02 09:53:41 -0700
commit1afea6b5761cf10332397b5e3f7a7350356ad3f7 (patch)
treecd26456776a26bba601c67b37eeffe1a9dcd1501 /spec/unit/recipe_spec.rb
parent6278cb8adb09d51265172638d1f938ba8e346139 (diff)
downloadchef-1afea6b5761cf10332397b5e3f7a7350356ad3f7.tar.gz
Clean up match code to get rid of TODO
Diffstat (limited to 'spec/unit/recipe_spec.rb')
-rw-r--r--spec/unit/recipe_spec.rb16
1 files changed, 10 insertions, 6 deletions
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)