diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-05-06 14:10:40 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-05-06 14:12:17 -0700 |
commit | 28a002f5f6549ed5d1452ebd4eefb7fd0004ddf4 (patch) | |
tree | 18ad043c8771a0b7eda036bd6dfc8d873ce99fdf /spec/unit | |
parent | 6461450d34b7d4837c6bbfc75113ce1797567e09 (diff) | |
download | chef-28a002f5f6549ed5d1452ebd4eefb7fd0004ddf4.tar.gz |
Fix windows_package not allowing version to be an array
Due to the way the resource is built we need to be able to store an
array of current versions. I added some tests and comments so we don't
refactor this away later.
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/resource/windows_package_spec.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/unit/resource/windows_package_spec.rb b/spec/unit/resource/windows_package_spec.rb index 282f9c5f05..be199f39b2 100644 --- a/spec/unit/resource/windows_package_spec.rb +++ b/spec/unit/resource/windows_package_spec.rb @@ -93,6 +93,16 @@ describe Chef::Resource::WindowsPackage, "initialize" do expect(resource.returns).to eq([0, 3010]) end + it "does not accept a string for the package_name property" do + expect { resource.package_name(%w{this should break}) }.to raise_error(Chef::Exceptions::ValidationFailed) + end + + # even though we don't do anything with arrays of versions we need them for current_value + it "accepts both Strings and Arrays for the version property" do + expect { resource.version "1.2.3" }.not_to raise_error + expect { resource.version ["1.2.3", "1.2.3.4"] }.not_to raise_error + end + it "defaults source to the resource name" do # it's a little late to stub out File.absolute_path expect(resource.source).to include("solitaire.msi") |