diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-01-22 11:41:11 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2018-01-22 11:41:11 -0800 |
commit | e32c1733567455dc6f3ce0f702d981f261413b90 (patch) | |
tree | e445572574b7c4897a869c84a1c2e77c0bb89e4a /spec/unit/recipe_spec.rb | |
parent | 9439fd6e5da8d87f48ebc1b6de4b7c09c8654c39 (diff) | |
download | chef-e32c1733567455dc6f3ce0f702d981f261413b90.tar.gz |
Convert node map to last-writer-wins for ties
We still bind preferentially by specificity, but for ties with
specificity we now prefer last-writer-wins instead of the alphabetic
by class name method we had before (that was never documented and I'm
pretty certain nobody understood).
So now `provides(:whatever) { true }` in a cookbook should always win
over core.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/unit/recipe_spec.rb')
-rw-r--r-- | spec/unit/recipe_spec.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/spec/unit/recipe_spec.rb b/spec/unit/recipe_spec.rb index 7a538b721b..93d03756a7 100644 --- a/spec/unit/recipe_spec.rb +++ b/spec/unit/recipe_spec.rb @@ -3,7 +3,7 @@ # Author:: Christopher Walters (<cw@chef.io>) # Author:: Tim Hinderliter (<tim@chef.io>) # Author:: Seth Chisamore (<schisamo@chef.io>) -# Copyright:: Copyright 2008-2017, Chef Software Inc. +# Copyright:: Copyright 2008-2018, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -141,16 +141,16 @@ describe Chef::Recipe do Object.send(:remove_const, :TottenhamHotspur) end - it "selects the first one alphabetically" do + it "selects the last-writer wins" do 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(Sounders) + expect(res1).to be_a_kind_of(TottenhamHotspur) end - it "selects the first one alphabetically even if the declaration order is reversed" do + it "selects the last-writer wins even if the declaration order is reversed" do TottenhamHotspur.provides :football2, platform: "nbc_sports" Sounders.provides :football2, platform: "nbc_sports" |