diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2020-02-26 11:47:50 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2020-02-26 11:47:50 -0800 |
commit | cf453de40ea9e8f70069b11890d52a09d96d441a (patch) | |
tree | a4f6bf578b6a78abe9ca673e3a87a2159381c7cd /spec | |
parent | 63633cc1ddfbf79ff77e97376184e2d27b954678 (diff) | |
download | chef-cf453de40ea9e8f70069b11890d52a09d96d441a.tar.gz |
Convert the node[:platform_version] to a Chef::VersionStringlcg/platform_version_sugar
`node[:platform_version] =~ "~> 1.2"` will now just work.
This might conceivably be breaking if people are doing really weird
things by the class changing (Chef::VersionString still inherits from
String though, so it'll have to be weirdness on par with the bad
`thing.class.to_s == "Mash"` kind of comparisons that were in ohai).
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/node_spec.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb index 1c84278ad5..5b50f888f0 100644 --- a/spec/unit/node_spec.rb +++ b/spec/unit/node_spec.rb @@ -1,6 +1,6 @@ # # Author:: Adam Jacob (<adam@chef.io>) -# Copyright:: Copyright 2008-2019, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -966,6 +966,13 @@ describe Chef::Node do expect(node.normal_attrs).to eq({ "foo" => "bar", "tags" => [] }) end + it "converts the platform_version to a Chef::VersionString" do + node.consume_external_attrs(@ohai_data, {}) + expect(node.automatic_attrs[:platform_version]).to be_a_kind_of(Chef::VersionString) + expect(node[:platform_version]).to be_a_kind_of(Chef::VersionString) + expect(node[:platform_version] =~ "~> 23.6").to be true + end + end describe "when expanding its run list and merging attributes" do |