summaryrefslogtreecommitdiff
path: root/spec/unit/node_map_spec.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2017-12-07 14:27:20 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2017-12-07 14:27:20 -0800
commit030266db26be2f307e554c48244283ada7c9e364 (patch)
tree1488804d66a85e768e45a72d04897637263f5da0 /spec/unit/node_map_spec.rb
parentfa1b53f2638bdf71ec7fe7c270b289b7239e17c0 (diff)
downloadchef-030266db26be2f307e554c48244283ada7c9e364.tar.gz
fix alphabetic sorting of classeslcg/node-map-speedup
but we really shouldn't do this... Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/unit/node_map_spec.rb')
-rw-r--r--spec/unit/node_map_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/unit/node_map_spec.rb b/spec/unit/node_map_spec.rb
index 64106323c2..7fa115b532 100644
--- a/spec/unit/node_map_spec.rb
+++ b/spec/unit/node_map_spec.rb
@@ -119,6 +119,22 @@ describe Chef::NodeMap do
end
end
+ describe "ordering classes" do
+ class Foo; end
+ class Bar; end
+ it "orders them alphabetically when they're set in the reverse order" do
+ node_map.set(:thing, Foo)
+ node_map.set(:thing, Bar)
+ expect(node_map.get(node, :thing)).to eql(Bar)
+ end
+
+ it "orders them alphabetically when they're set in alphabetic order" do
+ node_map.set(:thing, Bar)
+ node_map.set(:thing, Foo)
+ expect(node_map.get(node, :thing)).to eql(Bar)
+ end
+ end
+
describe "with a block doing platform_version checks" do
before do
node_map.set(:thing, :foo, platform_family: "rhel") do |node|