chef 15.11.3-universal-mingw32 → 15.15.0-universal-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -9
  3. data/README.md +3 -3
  4. data/chef-universal-mingw32.gemspec +2 -2
  5. data/chef.gemspec +12 -3
  6. data/distro/powershell/chef/chef.psm1 +3 -3
  7. data/distro/templates/powershell/chef/chef.psm1.erb +3 -3
  8. data/lib/chef/api_client/registration.rb +2 -2
  9. data/lib/chef/application/apply.rb +1 -1
  10. data/lib/chef/chef_fs/file_system/repository/base_file.rb +1 -0
  11. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +2 -2
  12. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +1 -1
  13. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +2 -2
  14. data/lib/chef/chef_fs/file_system/repository/directory.rb +1 -1
  15. data/lib/chef/chef_fs/file_system/repository/file_system_entry.rb +1 -1
  16. data/lib/chef/chef_fs/path_utils.rb +3 -3
  17. data/lib/chef/cookbook/file_system_file_vendor.rb +1 -1
  18. data/lib/chef/data_bag.rb +2 -2
  19. data/lib/chef/data_collector/error_handlers.rb +1 -1
  20. data/lib/chef/deprecated.rb +12 -0
  21. data/lib/chef/dsl/declare_resource.rb +1 -1
  22. data/lib/chef/dsl/platform_introspection.rb +2 -0
  23. data/lib/chef/environment.rb +2 -2
  24. data/lib/chef/exceptions.rb +3 -0
  25. data/lib/chef/http.rb +2 -1
  26. data/lib/chef/knife/bootstrap.rb +8 -10
  27. data/lib/chef/knife/bootstrap/templates/chef-full.erb +9 -9
  28. data/lib/chef/knife/bootstrap/train_connector.rb +1 -0
  29. data/lib/chef/knife/cookbook_download.rb +1 -1
  30. data/lib/chef/knife/cookbook_metadata.rb +1 -1
  31. data/lib/chef/knife/core/gem_glob_loader.rb +1 -1
  32. data/lib/chef/knife/core/hashed_command_loader.rb +3 -2
  33. data/lib/chef/knife/core/subcommand_loader.rb +1 -1
  34. data/lib/chef/knife/exec.rb +2 -2
  35. data/lib/chef/knife/ssh.rb +20 -1
  36. data/lib/chef/log.rb +1 -1
  37. data/lib/chef/mixin/openssl_helper.rb +26 -3
  38. data/lib/chef/mixin/template.rb +1 -0
  39. data/lib/chef/node_map.rb +5 -2
  40. data/lib/chef/provider/mount/solaris.rb +0 -1
  41. data/lib/chef/provider/package/cab.rb +1 -1
  42. data/lib/chef/provider/package/chocolatey.rb +1 -1
  43. data/lib/chef/provider/package/msu.rb +1 -0
  44. data/lib/chef/provider/package/powershell.rb +5 -1
  45. data/lib/chef/provider/package/snap.rb +96 -27
  46. data/lib/chef/provider/package/zypper.rb +0 -1
  47. data/lib/chef/provider/service/arch.rb +2 -2
  48. data/lib/chef/provider/service/debian.rb +1 -1
  49. data/lib/chef/provider/service/gentoo.rb +2 -2
  50. data/lib/chef/provider/service/macosx.rb +2 -2
  51. data/lib/chef/provider/service/openbsd.rb +1 -1
  52. data/lib/chef/provider/service/redhat.rb +2 -2
  53. data/lib/chef/provider/service/upstart.rb +1 -1
  54. data/lib/chef/provider/yum_repository.rb +1 -1
  55. data/lib/chef/provider/zypper_repository.rb +31 -11
  56. data/lib/chef/resource.rb +2 -0
  57. data/lib/chef/resource/archive_file.rb +28 -8
  58. data/lib/chef/resource/cron_access.rb +13 -5
  59. data/lib/chef/resource/cron_d.rb +2 -1
  60. data/lib/chef/resource/homebrew_cask.rb +3 -3
  61. data/lib/chef/resource/hostname.rb +19 -18
  62. data/lib/chef/resource/locale.rb +1 -1
  63. data/lib/chef/resource/lwrp_base.rb +7 -0
  64. data/lib/chef/resource/msu_package.rb +5 -0
  65. data/lib/chef/resource/ssh_known_hosts_entry.rb +1 -1
  66. data/lib/chef/resource/sudo.rb +2 -2
  67. data/lib/chef/resource/windows_feature_powershell.rb +6 -2
  68. data/lib/chef/resource/windows_font.rb +2 -1
  69. data/lib/chef/role.rb +2 -2
  70. data/lib/chef/shell.rb +1 -1
  71. data/lib/chef/shell/shell_session.rb +2 -0
  72. data/lib/chef/util/diff.rb +1 -1
  73. data/lib/chef/util/powershell/cmdlet.rb +1 -1
  74. data/lib/chef/version.rb +2 -2
  75. data/lib/chef/win32/file.rb +2 -2
  76. data/spec/functional/knife/ssh_spec.rb +4 -4
  77. data/spec/functional/resource/aix_service_spec.rb +0 -1
  78. data/spec/functional/resource/aixinit_service_spec.rb +7 -8
  79. data/spec/functional/resource/apt_package_spec.rb +0 -1
  80. data/spec/functional/resource/bff_spec.rb +2 -2
  81. data/spec/functional/resource/cookbook_file_spec.rb +1 -1
  82. data/spec/functional/resource/cron_spec.rb +0 -1
  83. data/spec/functional/resource/dsc_resource_spec.rb +1 -1
  84. data/spec/functional/resource/insserv_spec.rb +4 -5
  85. data/spec/functional/resource/link_spec.rb +17 -17
  86. data/spec/functional/resource/msu_package_spec.rb +5 -2
  87. data/spec/functional/resource/rpm_spec.rb +2 -2
  88. data/spec/functional/resource/user/dscl_spec.rb +1 -1
  89. data/spec/functional/resource/user/mac_user_spec.rb +1 -1
  90. data/spec/functional/resource/windows_certificate_spec.rb +3 -3
  91. data/spec/functional/resource/windows_font_spec.rb +49 -0
  92. data/spec/functional/resource/windows_task_spec.rb +8 -8
  93. data/spec/functional/run_lock_spec.rb +2 -1
  94. data/spec/functional/shell_spec.rb +5 -5
  95. data/spec/functional/util/powershell/cmdlet_spec.rb +1 -1
  96. data/spec/functional/version_spec.rb +1 -1
  97. data/spec/functional/win32/service_manager_spec.rb +1 -1
  98. data/spec/integration/recipes/accumulator_spec.rb +1 -1
  99. data/spec/integration/recipes/lwrp_inline_resources_spec.rb +2 -2
  100. data/spec/integration/recipes/lwrp_spec.rb +1 -1
  101. data/spec/integration/recipes/notifies_spec.rb +1 -1
  102. data/spec/integration/recipes/notifying_block_spec.rb +1 -1
  103. data/spec/integration/recipes/recipe_dsl_spec.rb +1 -1
  104. data/spec/integration/recipes/resource_converge_if_changed_spec.rb +2 -0
  105. data/spec/integration/recipes/resource_load_spec.rb +1 -0
  106. data/spec/integration/recipes/unified_mode_spec.rb +1 -1
  107. data/spec/scripts/ssl-serve.rb +1 -1
  108. data/spec/spec_helper.rb +26 -8
  109. data/spec/support/chef_helpers.rb +1 -1
  110. data/spec/support/platform_helpers.rb +12 -42
  111. data/spec/support/platforms/win32/spec_service.rb +1 -1
  112. data/spec/support/shared/functional/directory_resource.rb +1 -1
  113. data/spec/support/shared/functional/execute_resource.rb +1 -1
  114. data/spec/support/shared/functional/file_resource.rb +2 -2
  115. data/spec/support/shared/functional/win32_service.rb +1 -1
  116. data/spec/support/shared/functional/windows_script.rb +3 -3
  117. data/spec/support/shared/integration/knife_support.rb +2 -5
  118. data/spec/unit/application_spec.rb +7 -0
  119. data/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb +2 -4
  120. data/spec/unit/cookbook/gem_installer_spec.rb +2 -1
  121. data/spec/unit/data_bag_spec.rb +1 -1
  122. data/spec/unit/data_collector_spec.rb +1 -1
  123. data/spec/unit/dsl/platform_introspection_spec.rb +1 -0
  124. data/spec/unit/environment_spec.rb +7 -7
  125. data/spec/unit/event_dispatch/dispatcher_spec.rb +3 -0
  126. data/spec/unit/file_access_control_spec.rb +1 -1
  127. data/spec/unit/json_compat_spec.rb +1 -1
  128. data/spec/unit/knife/bootstrap_spec.rb +16 -16
  129. data/spec/unit/knife/cookbook_download_spec.rb +4 -4
  130. data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +1 -1
  131. data/spec/unit/knife/cookbook_upload_spec.rb +5 -6
  132. data/spec/unit/knife/core/hashed_command_loader_spec.rb +3 -3
  133. data/spec/unit/knife/ssh_spec.rb +2 -2
  134. data/spec/unit/knife/supermarket_share_spec.rb +1 -1
  135. data/spec/unit/lwrp_spec.rb +4 -4
  136. data/spec/unit/mixin/securable_spec.rb +0 -1
  137. data/spec/unit/mixin/user_context_spec.rb +1 -9
  138. data/spec/unit/property_spec.rb +6 -6
  139. data/spec/unit/provider/apt_repository_spec.rb +2 -2
  140. data/spec/unit/provider/package/dnf/python_helper_spec.rb +1 -1
  141. data/spec/unit/provider/package/powershell_spec.rb +95 -86
  142. data/spec/unit/provider/package/rubygems_spec.rb +5 -10
  143. data/spec/unit/provider/package/snap_spec.rb +1 -1
  144. data/spec/unit/provider/package/windows_spec.rb +30 -53
  145. data/spec/unit/provider/service/arch_service_spec.rb +3 -2
  146. data/spec/unit/provider/service/debian_service_spec.rb +1 -1
  147. data/spec/unit/provider/service/gentoo_service_spec.rb +7 -7
  148. data/spec/unit/provider/service/macosx_spec.rb +3 -3
  149. data/spec/unit/provider/service/redhat_spec.rb +2 -2
  150. data/spec/unit/provider/service/upstart_service_spec.rb +3 -3
  151. data/spec/unit/provider/service/windows_spec.rb +2 -6
  152. data/spec/unit/provider/systemd_unit_spec.rb +28 -24
  153. data/spec/unit/provider/zypper_repository_spec.rb +75 -25
  154. data/spec/unit/provider_spec.rb +1 -0
  155. data/spec/unit/resource/archive_file_spec.rb +11 -2
  156. data/spec/unit/resource/msu_package_spec.rb +4 -0
  157. data/spec/unit/resource/windows_dns_record_spec.rb +3 -3
  158. data/spec/unit/resource/windows_dns_zone_spec.rb +2 -2
  159. data/spec/unit/resource/windows_feature_powershell_spec.rb +30 -4
  160. data/spec/unit/resource/windows_package_spec.rb +1 -0
  161. data/spec/unit/resource/windows_task_spec.rb +1 -1
  162. data/spec/unit/resource/windows_uac_spec.rb +2 -2
  163. data/spec/unit/resource/yum_repository_spec.rb +21 -21
  164. data/spec/unit/resource_reporter_spec.rb +1 -1
  165. data/spec/unit/resource_spec.rb +1 -1
  166. data/spec/unit/role_spec.rb +11 -11
  167. data/spec/unit/run_context/cookbook_compiler_spec.rb +1 -1
  168. data/spec/unit/run_lock_spec.rb +1 -1
  169. data/spec/unit/scan_access_control_spec.rb +1 -1
  170. data/spec/unit/util/threaded_job_queue_spec.rb +9 -0
  171. data/spec/unit/win32/security_spec.rb +4 -3
  172. data/tasks/rspec.rb +5 -13
  173. metadata +38 -19
@@ -34,7 +34,7 @@ describe Chef::Knife::CookbookMetadataFromFile do
34
34
  end
35
35
 
36
36
  after do
37
- if File.exists?(@tgt)
37
+ if File.exist?(@tgt)
38
38
  File.unlink(@tgt)
39
39
  end
40
40
  end
@@ -323,19 +323,18 @@ describe Chef::Knife::CookbookUpload do
323
323
 
324
324
  context "when cookbook path is an array" do
325
325
  it "should warn users that no cookbooks exist" do
326
- knife.config[:cookbook_path] = ["/chef-repo/cookbooks", "/home/user/cookbooks"]
327
- expect(knife.ui).to receive(:warn).with(
328
- /Could not find any cookbooks in your cookbook path: '#{knife.config[:cookbook_path].join(', ')}'\. Use --cookbook-path to specify the desired path\./
329
- )
326
+ cookbook_path = windows? ? "C:/chef-repo/cookbooks" : "/chef-repo/cookbooks"
327
+ knife.config[:cookbook_path] = [cookbook_path, "/home/user/cookbooks"]
328
+ expect(knife.ui).to receive(:warn).with("Could not find any cookbooks in your cookbook path: '#{knife.config[:cookbook_path].join(", ")}'. Use --cookbook-path to specify the desired path.")
330
329
  knife.run
331
330
  end
332
331
  end
333
332
 
334
333
  context "when cookbook path is a string" do
335
334
  it "should warn users that no cookbooks exist" do
336
- knife.config[:cookbook_path] = "/chef-repo/cookbooks"
335
+ knife.config[:cookbook_path] = windows? ? "C:/chef-repo/cookbooks" : "/chef-repo/cookbooks"
337
336
  expect(knife.ui).to receive(:warn).with(
338
- /Could not find any cookbooks in your cookbook path: '#{knife.config[:cookbook_path]}'\. Use --cookbook-path to specify the desired path\./
337
+ "Could not find any cookbooks in your cookbook path: '#{knife.config[:cookbook_path]}'. Use --cookbook-path to specify the desired path."
339
338
  )
340
339
  knife.run
341
340
  end
@@ -50,7 +50,7 @@ describe Chef::Knife::SubcommandLoader::HashedCommandLoader do
50
50
 
51
51
  describe "#list_commands" do
52
52
  before do
53
- allow(File).to receive(:exists?).and_return(true)
53
+ allow(File).to receive(:exist?).and_return(true)
54
54
  end
55
55
 
56
56
  it "lists all commands by category when no argument is given" do
@@ -63,7 +63,7 @@ describe Chef::Knife::SubcommandLoader::HashedCommandLoader do
63
63
 
64
64
  context "when the plugin path is invalid" do
65
65
  before do
66
- expect(File).to receive(:exists?).with("/file/for/plugin/b").and_return(false)
66
+ expect(File).to receive(:exist?).with("/file/for/plugin/b").and_return(false)
67
67
  end
68
68
 
69
69
  it "lists all commands by category when no argument is given" do
@@ -90,7 +90,7 @@ describe Chef::Knife::SubcommandLoader::HashedCommandLoader do
90
90
  end
91
91
 
92
92
  it "loads the correct file and returns true if the command exists" do
93
- allow(File).to receive(:exists?).and_return(true)
93
+ allow(File).to receive(:exist?).and_return(true)
94
94
  expect(Kernel).to receive(:load).with("/file/for/plugin/a").and_return(true)
95
95
  expect(loader.load_command(["cool_a"])).to eq(true)
96
96
  end
@@ -279,10 +279,10 @@ describe Chef::Knife::Ssh do
279
279
  end
280
280
 
281
281
  describe "#ssh_command" do
282
- let(:execution_channel) { double(:execution_channel, on_data: nil) }
282
+ let(:execution_channel) { double(:execution_channel, on_data: nil, on_extended_data: nil) }
283
283
  let(:session_channel) { double(:session_channel, request_pty: nil) }
284
284
 
285
- let(:execution_channel2) { double(:execution_channel, on_data: nil) }
285
+ let(:execution_channel2) { double(:execution_channel, on_data: nil, on_extended_data: nil) }
286
286
  let(:session_channel2) { double(:session_channel, request_pty: nil) }
287
287
 
288
288
  let(:session) { double(:session, loop: nil) }
@@ -108,7 +108,7 @@ describe Chef::Knife::SupermarketShare do
108
108
  expect { @knife.run }.to raise_error(SystemExit)
109
109
  end
110
110
 
111
- if File.exists?("/usr/bin/gnutar") || File.exists?("/bin/gnutar")
111
+ if File.exist?("/usr/bin/gnutar") || File.exist?("/bin/gnutar")
112
112
  it "should use gnutar to make a tarball of the cookbook" do
113
113
  expect(@knife).to receive(:shell_out!) do |args|
114
114
  expect(args.to_s).to match(/gnutar -czf/)
@@ -140,7 +140,7 @@ describe "LWRP" do
140
140
  before do
141
141
  @tmpdir = Dir.mktmpdir("lwrp_test")
142
142
  @lwrp_path = File.join(@tmpdir, "foo.rb")
143
- content = IO.read(File.expand_path("../../data/lwrp/resources/foo.rb", __FILE__))
143
+ content = IO.read(File.expand_path("../data/lwrp/resources/foo.rb", __dir__))
144
144
  IO.write(@lwrp_path, content)
145
145
  Chef::Resource::LWRPBase.build_from_file("lwrp", @lwrp_path, nil)
146
146
  @original_resource = Chef::ResourceResolver.resolve(:lwrp_foo)
@@ -152,7 +152,7 @@ describe "LWRP" do
152
152
 
153
153
  context "And the LWRP is asked to load again, this time with different code" do
154
154
  before do
155
- content = IO.read(File.expand_path("../../data/lwrp_override/resources/foo.rb", __FILE__))
155
+ content = IO.read(File.expand_path("../data/lwrp_override/resources/foo.rb", __dir__))
156
156
  IO.write(@lwrp_path, content)
157
157
  Chef::Resource::LWRPBase.build_from_file("lwrp", @lwrp_path, nil)
158
158
  end
@@ -390,11 +390,11 @@ describe "LWRP" do
390
390
  end
391
391
 
392
392
  before(:each) do
393
- Dir[File.expand_path(File.expand_path("../../data/lwrp/resources/*", __FILE__))].each do |file|
393
+ Dir[File.expand_path(File.expand_path("../data/lwrp/resources/*", __dir__))].each do |file|
394
394
  Chef::Resource::LWRPBase.build_from_file(lwrp_cookbook_name, file, run_context)
395
395
  end
396
396
 
397
- Dir[File.expand_path(File.expand_path("../../data/lwrp/providers/*", __FILE__))].each do |file|
397
+ Dir[File.expand_path(File.expand_path("../data/lwrp/providers/*", __dir__))].each do |file|
398
398
  Chef::Provider::LWRPBase.build_from_file(lwrp_cookbook_name, file, run_context)
399
399
  end
400
400
  end
@@ -1,4 +1,3 @@
1
- # encoding: UTF-8
2
1
  #
3
2
  # Author:: Mark Mzyk (<mmzyk@chef.io>)
4
3
  # Copyright:: Copyright (c) Chef Software Inc.
@@ -77,17 +77,9 @@ describe "a class that mixes in user_context" do
77
77
  end
78
78
 
79
79
  context "when the block raises an exception" do
80
- class UserContextTestException < RuntimeError
81
- end
82
- let(:block_parameter) { Proc.new { raise UserContextTextException } }
83
-
84
- it "raises the exception raised by the block" do
85
- expect { instance_with_user_context.with_context("kamilah", nil, "chef4life", &block_parameter) }.not_to raise_error(UserContextTestException)
86
- end
87
-
88
80
  it "closes the logon session so resources are not leaked" do
89
81
  expect(logon_session).to receive(:close)
90
- expect { instance_with_user_context.with_context("kamilah", nil, "chef4life", &block_parameter) }.not_to raise_error(UserContextTestException)
82
+ expect { instance_with_user_context.with_context("kamilah", nil, "chef4life") { 1 / 0 } }.to raise_error(ZeroDivisionError)
91
83
  end
92
84
  end
93
85
  end
@@ -111,17 +111,17 @@ describe "Chef::Resource.property" do
111
111
 
112
112
  with_property ":Straße" do
113
113
  it "properties with UTF-8 in their name work" do
114
- expect(resource.Straße).to eql(nil)
115
- expect(resource.Straße "foo").to eql("foo")
116
- expect(resource.Straße).to eql("foo")
117
- expect(resource.Straße = "bar").to eql("bar")
118
- expect(resource.Straße).to eql("bar")
114
+ expect(resource.Straße).to eql(nil) # rubocop: disable Naming/AsciiIdentifiers
115
+ expect(resource.Straße "foo").to eql("foo") # rubocop: disable Naming/AsciiIdentifiers
116
+ expect(resource.Straße).to eql("foo") # rubocop: disable Naming/AsciiIdentifiers
117
+ expect(resource.Straße = "bar").to eql("bar") # rubocop: disable Naming/AsciiIdentifiers
118
+ expect(resource.Straße).to eql("bar") # rubocop: disable Naming/AsciiIdentifiers
119
119
  end
120
120
  end
121
121
 
122
122
  context "deprecated properties" do
123
123
  it "does not create a deprecation warning on definition" do
124
- expect { resource_class.class_eval { property :x, String, deprecated: 10 } }.not_to raise_error Chef::Exceptions::DeprecatedFeatureError
124
+ expect { resource_class.class_eval { property :x, String, deprecated: 10 } }.not_to raise_error
125
125
  end
126
126
 
127
127
  with_property ":x, deprecated: 'a deprecated property'" do
@@ -38,7 +38,7 @@ EOF
38
38
 
39
39
  # Output of the command:
40
40
  # => gpg --with-fingerprint --with-colons [FILE]
41
- GPG_FINGER = <<~EOF.freeze
41
+ APT_GPG_FINGER = <<~EOF.freeze
42
42
  pub:-:1024:17:327574EE02A818DD:2009-04-22:::-:Cloudera Apt Repository:
43
43
  fpr:::::::::F36A89E33CC1BD0F71079007327574EE02A818DD:
44
44
  sub:-:2048:16:84080586D1CA74A1:2009-04-22::::
@@ -63,7 +63,7 @@ describe Chef::Provider::AptRepository do
63
63
  end
64
64
 
65
65
  let(:gpg_finger) do
66
- double("shell_out", stdout: GPG_FINGER, exitstatus: 0, error?: false)
66
+ double("shell_out", stdout: APT_GPG_FINGER, exitstatus: 0, error?: false)
67
67
  end
68
68
 
69
69
  let(:gpg_shell_out_success) do
@@ -22,7 +22,7 @@ require "spec_helper"
22
22
  describe Chef::Provider::Package::Dnf::PythonHelper do
23
23
  let(:helper) { Chef::Provider::Package::Dnf::PythonHelper.instance }
24
24
 
25
- it "propagates stacktraces on stderr from the forked subprocess" do
25
+ it "propagates stacktraces on stderr from the forked subprocess", :rhel do
26
26
  allow(helper).to receive(:dnf_command).and_return("ruby -e 'raise \"your hands in the air\"'")
27
27
  expect { helper.query(:whatprovides, "tcpdump") }.to raise_error(/your hands in the air/)
28
28
  end
@@ -93,19 +93,19 @@ describe Chef::Provider::Package::Powershell do
93
93
  double("powershell_out", stdout: "5")
94
94
  end
95
95
 
96
- let(:generated_command) { "( Get-Package posh-git -Force -ForceBootstrap ).Version" }
97
- let(:generated_get_cmdlet) { "( Get-Package xNetworking -Force -ForceBootstrap ).Version" }
98
- let(:generated_get_cmdlet_with_version) { "( Get-Package xNetworking -Force -ForceBootstrap -RequiredVersion 1.0.0.0 ).Version" }
99
- let(:generated_find_cmdlet) { "( Find-Package xNetworking -Force -ForceBootstrap ).Version" }
100
- let(:generated_find_cmdlet_with_version) { "( Find-Package xNetworking -Force -ForceBootstrap -RequiredVersion 1.0.0.0 ).Version" }
101
- let(:generated_find_cmdlet_with_source) { "( Find-Package xNetworking -Force -ForceBootstrap -Source MyGallery ).Version" }
102
- let(:generated_find_cmdlet_with_source_and_version) { "( Find-Package xNetworking -Force -ForceBootstrap -RequiredVersion 1.0.0.0 -Source MyGallery ).Version" }
103
- let(:generated_install_cmdlet) { "( Install-Package xNetworking -Force -ForceBootstrap ).Version" }
104
- let(:generated_install_cmdlet_with_version) { "( Install-Package xNetworking -Force -ForceBootstrap -RequiredVersion 1.0.0.0 ).Version" }
105
- let(:generated_install_cmdlet_with_source) { "( Install-Package xNetworking -Force -ForceBootstrap -Source MyGallery ).Version" }
106
- let(:generated_install_cmdlet_with_source_and_version) { "( Install-Package xNetworking -Force -ForceBootstrap -RequiredVersion 1.0.0.0 -Source MyGallery ).Version" }
107
- let(:generated_uninstall_cmdlet) { "( Uninstall-Package xNetworking -Force -ForceBootstrap ).Version" }
108
- let(:generated_uninstall_cmdlet_with_version) { "( Uninstall-Package xNetworking -Force -ForceBootstrap -RequiredVersion 1.0.0.0 ).Version" }
96
+ let(:generated_command) { "( Get-Package posh-git -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version" }
97
+ let(:generated_get_cmdlet) { "( Get-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version" }
98
+ let(:generated_get_cmdlet_with_version) { "( Get-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 1.0.0.0 ).Version" }
99
+ let(:generated_find_cmdlet) { "( Find-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version" }
100
+ let(:generated_find_cmdlet_with_version) { "( Find-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 1.0.0.0 ).Version" }
101
+ let(:generated_find_cmdlet_with_source) { "( Find-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -Source MyGallery ).Version" }
102
+ let(:generated_find_cmdlet_with_source_and_version) { "( Find-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 1.0.0.0 -Source MyGallery ).Version" }
103
+ let(:generated_install_cmdlet) { "( Install-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version" }
104
+ let(:generated_install_cmdlet_with_version) { "( Install-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 1.0.0.0 ).Version" }
105
+ let(:generated_install_cmdlet_with_source) { "( Install-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -Source MyGallery ).Version" }
106
+ let(:generated_install_cmdlet_with_source_and_version) { "( Install-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 1.0.0.0 -Source MyGallery ).Version" }
107
+ let(:generated_uninstall_cmdlet) { "( Uninstall-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version" }
108
+ let(:generated_uninstall_cmdlet_with_version) { "( Uninstall-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 1.0.0.0 ).Version" }
109
109
 
110
110
  describe "#initialize" do
111
111
  it "should return the correct class" do
@@ -116,14 +116,14 @@ describe Chef::Provider::Package::Powershell do
116
116
  describe "#candidate_version" do
117
117
 
118
118
  it "should set the candidate_version to the latest version when not pinning" do
119
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
119
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
120
120
  new_resource.package_name(["xNetworking"])
121
121
  new_resource.version(nil)
122
122
  expect(provider.candidate_version).to eql(["2.12.0.0"])
123
123
  end
124
124
 
125
125
  it "should use the candidate_version from the correct source" do
126
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -Source MyGallery ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
126
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue -Source MyGallery ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
127
127
  new_resource.package_name(["xNetworking"])
128
128
  new_resource.version(nil)
129
129
  new_resource.source("MyGallery")
@@ -131,60 +131,60 @@ describe Chef::Provider::Package::Powershell do
131
131
  end
132
132
 
133
133
  it "should set the candidate_version to the latest version when not pinning and package name is space seperated" do
134
- allow(provider).to receive(:powershell_out).with("( Find-Package '7-Zip 16.02 (x64)' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_7zip_available)
134
+ allow(provider).to receive(:powershell_out).with("( Find-Package '7-Zip 16.02 (x64)' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_7zip_available)
135
135
  new_resource.package_name(["7-Zip 16.02 (x64)"])
136
136
  new_resource.version(nil)
137
137
  expect(provider.candidate_version).to eql(["16.02"])
138
138
  end
139
139
 
140
140
  it "should set the candidate_version to pinned version if available" do
141
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.0.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available_2_0_0_0)
141
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.0.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available_2_0_0_0)
142
142
  new_resource.package_name(["xCertificate"])
143
143
  new_resource.version(["2.0.0.0"])
144
144
  expect(provider.candidate_version).to eql(["2.0.0.0"])
145
145
  end
146
146
 
147
147
  it "should set the candidate_version to nil if there is no candidate" do
148
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
148
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
149
149
  new_resource.package_name(["xCertificate"])
150
150
  expect(provider.candidate_version).to eql([nil])
151
151
  end
152
152
 
153
153
  it "should set the candidate_version correctly when there are two packages to install" do
154
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
155
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
154
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
155
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
156
156
  new_resource.package_name(%w{xCertificate xNetworking})
157
157
  new_resource.version(nil)
158
158
  expect(provider.candidate_version).to eql(["2.1.0.0", "2.12.0.0"])
159
159
  end
160
160
 
161
161
  it "should set the candidate_version correctly when only the first is installable" do
162
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
163
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
162
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
163
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
164
164
  new_resource.package_name(%w{xCertificate xNetworking})
165
165
  new_resource.version(nil)
166
166
  expect(provider.candidate_version).to eql(["2.1.0.0", nil])
167
167
  end
168
168
 
169
169
  it "should set the candidate_version correctly when only the last is installable" do
170
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
171
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
170
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
171
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
172
172
  new_resource.package_name(%w{xCertificate xNetworking})
173
173
  new_resource.version(nil)
174
174
  expect(provider.candidate_version).to eql([nil, "2.12.0.0"])
175
175
  end
176
176
 
177
177
  it "should set the candidate_version correctly when neither are is installable and version is passed as nil array" do
178
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
179
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
178
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
179
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
180
180
  new_resource.package_name(%w{xNetworking xCertificate})
181
181
  new_resource.version([nil, nil])
182
182
  expect(provider.candidate_version).to eql([nil, nil])
183
183
  end
184
184
 
185
185
  it "should set the candidate_version correctly when neither are is installable and version is not passed" do
186
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
187
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
186
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
187
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
188
188
  new_resource.package_name(%w{xNetworking xCertificate})
189
189
  new_resource.version(nil)
190
190
  expect(provider.candidate_version).to eql([nil, nil])
@@ -283,10 +283,11 @@ describe Chef::Provider::Package::Powershell do
283
283
  provider.load_current_resource
284
284
  new_resource.package_name(["xCertificate"])
285
285
  new_resource.version(nil)
286
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
287
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
286
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
287
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
288
288
  allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
289
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
289
+ allow(provider).to receive(:powershell_out).with("[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12")
290
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
290
291
  provider.run_action(:install)
291
292
  expect(new_resource).to be_updated_by_last_action
292
293
  end
@@ -296,10 +297,11 @@ describe Chef::Provider::Package::Powershell do
296
297
  new_resource.package_name(["xCertificate"])
297
298
  new_resource.version(nil)
298
299
  new_resource.source("MyGallery")
299
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -Source MyGallery ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
300
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
300
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -Source MyGallery ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
301
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
301
302
  allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
302
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 -Source MyGallery ).Version", { timeout: new_resource.timeout })
303
+ allow(provider).to receive(:powershell_out).with("[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12")
304
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 -Source MyGallery ).Version", { timeout: new_resource.timeout })
303
305
  provider.run_action(:install)
304
306
  expect(new_resource).to be_updated_by_last_action
305
307
  end
@@ -309,10 +311,11 @@ describe Chef::Provider::Package::Powershell do
309
311
  new_resource.package_name(["xCertificate"])
310
312
  new_resource.version(nil)
311
313
  new_resource.skip_publisher_check(true)
312
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
313
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -SkipPublisherCheck ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
314
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
315
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -SkipPublisherCheck ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
314
316
  allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
315
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 -SkipPublisherCheck ).Version", { timeout: new_resource.timeout })
317
+ allow(provider).to receive(:powershell_out).with("[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12")
318
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 -SkipPublisherCheck ).Version", { timeout: new_resource.timeout })
316
319
  provider.run_action(:install)
317
320
  expect(new_resource).to be_updated_by_last_action
318
321
  end
@@ -321,10 +324,11 @@ describe Chef::Provider::Package::Powershell do
321
324
  provider.load_current_resource
322
325
  new_resource.package_name(["7-Zip 16.02 (x64)"])
323
326
  new_resource.version(nil)
324
- allow(provider).to receive(:powershell_out).with("( Find-Package '7-Zip 16.02 (x64)' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_7zip_available)
325
- allow(provider).to receive(:powershell_out).with("( Get-Package '7-Zip 16.02 (x64)' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_7zip_not_installed)
327
+ allow(provider).to receive(:powershell_out).with("( Find-Package '7-Zip 16.02 (x64)' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_7zip_available)
328
+ allow(provider).to receive(:powershell_out).with("( Get-Package '7-Zip 16.02 (x64)' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_7zip_not_installed)
326
329
  allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
327
- expect(provider).to receive(:powershell_out).with("( Install-Package '7-Zip 16.02 (x64)' -Force -ForceBootstrap -RequiredVersion 16.02 ).Version", { timeout: new_resource.timeout })
330
+ allow(provider).to receive(:powershell_out).with("[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12")
331
+ expect(provider).to receive(:powershell_out).with("( Install-Package '7-Zip 16.02 (x64)' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 16.02 ).Version", { timeout: new_resource.timeout })
328
332
  provider.run_action(:install)
329
333
  expect(new_resource).to be_updated_by_last_action
330
334
  end
@@ -336,10 +340,11 @@ describe Chef::Provider::Package::Powershell do
336
340
  provider.load_current_resource
337
341
  new_resource.package_name(["xCertificate"])
338
342
  new_resource.version(nil)
339
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
340
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
343
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
344
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
341
345
  allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
342
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
346
+ allow(provider).to receive(:powershell_out).with("[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12")
347
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
343
348
  provider.run_action(:install)
344
349
  expect(new_resource).to be_updated_by_last_action
345
350
  end
@@ -348,8 +353,8 @@ describe Chef::Provider::Package::Powershell do
348
353
  it "should not install packages that are up-to-date" do
349
354
  new_resource.package_name(["xCertificate"])
350
355
  new_resource.version(nil)
351
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
352
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
356
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
357
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
353
358
  allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
354
359
  provider.load_current_resource
355
360
  expect(provider).not_to receive(:install_package)
@@ -360,8 +365,8 @@ describe Chef::Provider::Package::Powershell do
360
365
  it "should not install packages that are up-to-date" do
361
366
  new_resource.package_name(["xNetworking"])
362
367
  new_resource.version(["2.11.0.0"])
363
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
364
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available_2_11_0_0)
368
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
369
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available_2_11_0_0)
365
370
  allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
366
371
  provider.load_current_resource
367
372
  expect(provider).not_to receive(:install_package)
@@ -374,13 +379,14 @@ describe Chef::Provider::Package::Powershell do
374
379
  # new_version.resource[0]
375
380
  new_resource.package_name(%w{xCertificate xNetworking})
376
381
  new_resource.version([nil, "2.11.0.0"])
377
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
378
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
379
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available_2_11_0_0)
380
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
382
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
383
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
384
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available_2_11_0_0)
385
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
381
386
  allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
382
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
383
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout })
387
+ allow(provider).to receive(:powershell_out).with("[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12")
388
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
389
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout })
384
390
  provider.load_current_resource
385
391
  provider.run_action(:install)
386
392
  expect(new_resource).to be_updated_by_last_action
@@ -389,13 +395,14 @@ describe Chef::Provider::Package::Powershell do
389
395
  it "should split up commands when given two packages, one with a version pin" do
390
396
  new_resource.package_name(%w{xCertificate xNetworking})
391
397
  new_resource.version(["2.1.0.0", nil])
392
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
393
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
394
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
395
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
398
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
399
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
400
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
401
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
396
402
  allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
397
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
398
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.12.0.0 ).Version", { timeout: new_resource.timeout })
403
+ allow(provider).to receive(:powershell_out).with("[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12")
404
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
405
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.12.0.0 ).Version", { timeout: new_resource.timeout })
399
406
 
400
407
  provider.load_current_resource
401
408
  provider.run_action(:install)
@@ -405,13 +412,14 @@ describe Chef::Provider::Package::Powershell do
405
412
  it "should do multipackage installs when given two packages without constraints" do
406
413
  new_resource.package_name(%w{xCertificate xNetworking})
407
414
  new_resource.version(nil)
408
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
409
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
410
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
411
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
415
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
416
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
417
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
418
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
412
419
  allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
413
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
414
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.12.0.0 ).Version", { timeout: new_resource.timeout })
420
+ allow(provider).to receive(:powershell_out).with("[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12")
421
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
422
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.12.0.0 ).Version", { timeout: new_resource.timeout })
415
423
  provider.load_current_resource
416
424
  provider.run_action(:install)
417
425
  expect(new_resource).to be_updated_by_last_action
@@ -421,13 +429,14 @@ describe Chef::Provider::Package::Powershell do
421
429
  new_resource.package_name(%w{xCertificate xNetworking})
422
430
  new_resource.version(nil)
423
431
  new_resource.source("MyGallery")
424
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -Source MyGallery ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
425
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
426
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -Source MyGallery ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
427
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
432
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -Source MyGallery ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
433
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
434
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue -Source MyGallery ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
435
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
428
436
  allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
429
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 -Source MyGallery ).Version", { timeout: new_resource.timeout })
430
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.12.0.0 -Source MyGallery ).Version", { timeout: new_resource.timeout })
437
+ allow(provider).to receive(:powershell_out).with("[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12")
438
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 -Source MyGallery ).Version", { timeout: new_resource.timeout })
439
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.12.0.0 -Source MyGallery ).Version", { timeout: new_resource.timeout })
431
440
  provider.load_current_resource
432
441
  provider.run_action(:install)
433
442
  expect(new_resource).to be_updated_by_last_action
@@ -439,8 +448,8 @@ describe Chef::Provider::Package::Powershell do
439
448
  provider.load_current_resource
440
449
  new_resource.package_name(["xCertificate"])
441
450
  new_resource.version(["2.1.0.0"])
442
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
443
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
451
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
452
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
444
453
  allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
445
454
  expect(provider).not_to receive(:remove_package)
446
455
  provider.run_action(:remove)
@@ -451,11 +460,11 @@ describe Chef::Provider::Package::Powershell do
451
460
  new_resource.package_name(["xCertificate"])
452
461
  new_resource.version(["2.1.0.0"])
453
462
  new_resource.source("MyGallery")
454
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 -Source MyGallery).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
455
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
463
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 -Source MyGallery).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
464
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
456
465
  allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
457
466
  provider.load_current_resource
458
- expect(provider).to receive(:powershell_out).with("( Uninstall-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
467
+ expect(provider).to receive(:powershell_out).with("( Uninstall-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
459
468
  provider.run_action(:remove)
460
469
  expect(new_resource).to be_updated_by_last_action
461
470
  end
@@ -463,10 +472,10 @@ describe Chef::Provider::Package::Powershell do
463
472
  it "does nothing when all the packages are already removed" do
464
473
  new_resource.package_name(%w{xCertificate xNetworking})
465
474
  new_resource.version(nil)
466
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
467
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
468
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
469
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
475
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
476
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
477
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
478
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
470
479
  allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
471
480
  provider.load_current_resource
472
481
  expect(provider).not_to receive(:remove_package)
@@ -477,11 +486,11 @@ describe Chef::Provider::Package::Powershell do
477
486
  it "removes a package when version is specified" do
478
487
  new_resource.package_name(["xCertificate"])
479
488
  new_resource.version(["2.1.0.0"])
480
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
481
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
489
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
490
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
482
491
  allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
483
492
  provider.load_current_resource
484
- expect(provider).to receive(:powershell_out).with("( Uninstall-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
493
+ expect(provider).to receive(:powershell_out).with("( Uninstall-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
485
494
  provider.run_action(:remove)
486
495
  expect(new_resource).to be_updated_by_last_action
487
496
  end
@@ -489,11 +498,11 @@ describe Chef::Provider::Package::Powershell do
489
498
  it "removes a package when version is not specified" do
490
499
  new_resource.package_name(["xCertificate"])
491
500
  new_resource.version(nil)
492
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
493
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
501
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
502
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
494
503
  allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
495
504
  provider.load_current_resource
496
- expect(provider).to receive(:powershell_out).with("( Uninstall-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
505
+ expect(provider).to receive(:powershell_out).with("( Uninstall-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
497
506
  provider.run_action(:remove)
498
507
  expect(new_resource).to be_updated_by_last_action
499
508
  end