diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2020-04-16 22:43:25 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2020-04-16 22:43:25 -0700 |
commit | 5c7e4ba0308f33fc28dd693f23403673f10a527a (patch) | |
tree | 92d8e5e8deee627a51e0ee6eb53371ea39b8892f | |
parent | 35fde7009976d30d3783266b51828a6afe5f712c (diff) | |
download | chef-lcg/fix-platform-version-magicsauc.tar.gz |
Add unit tests around Chef::VersionStringlcg/fix-platform-version-magicsauc
I guess this is minimum viable testing to ensure this doesn't break in
the future.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r-- | spec/unit/node_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb index e6d351bc0d..f2a5528b52 100644 --- a/spec/unit/node_spec.rb +++ b/spec/unit/node_spec.rb @@ -940,6 +940,23 @@ describe Chef::Node do expect(node["one"].to_hash).to eq({ "two" => { "three" => "forty-two" } }) end + it "converts the platform_version to a Chef::VersionString" do + node.consume_external_attrs(@ohai_data, {}) + expect(node["platform_version"]).to be_kind_of(Chef::VersionString) + end + end + + describe "merging ohai data" do + before do + @ohai_data = { platform: "foo", platform_version: "bar" } + end + + it "converts the platform_version to a Chef::VersionString" do + node.consume_external_attrs(@ohai_data, {}) + node.consume_ohai_data({ "platform_version" => "6.3" }) + expect(node["platform_version"]).to be_kind_of(Chef::VersionString) + expect(node["platform_version"] =~ "~> 6.1").to be true + end end describe "preparing for a chef client run" do |