diff options
Diffstat (limited to 'spec/unit/mixin/shell_out_spec.rb')
-rw-r--r-- | spec/unit/mixin/shell_out_spec.rb | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/spec/unit/mixin/shell_out_spec.rb b/spec/unit/mixin/shell_out_spec.rb index afa3687a15..f2b0295bf6 100644 --- a/spec/unit/mixin/shell_out_spec.rb +++ b/spec/unit/mixin/shell_out_spec.rb @@ -246,35 +246,33 @@ describe Chef::Mixin::ShellOut do let(:new_resource) { CustomResource.new("foo") } let(:provider) { new_resource.provider_for_action(:install) } - describe "on Chef-15", chef: ">= 15" do - %i{shell_out shell_out!}.each do |method| - stubbed_method = (method == :shell_out) ? :shell_out_compacted : :shell_out_compacted! - it "#{method} defaults to 900 seconds" do - expect(provider).to receive(stubbed_method).with("foo", timeout: 900) - provider.send(method, "foo") - end - it "#{method} overrides the default timeout with its options" do - expect(provider).to receive(stubbed_method).with("foo", timeout: 1) - provider.send(method, "foo", timeout: 1) - end - it "#{method} overrides the new_resource.timeout with the timeout option" do - new_resource.timeout(99) - expect(provider).to receive(stubbed_method).with("foo", timeout: 1) - provider.send(method, "foo", timeout: 1) - end - it "#{method} defaults to 900 seconds and preserves options" do - expect(provider).to receive(stubbed_method).with("foo", env: nil, timeout: 900) - provider.send(method, "foo", env: nil) - end - it "#{method} overrides the default timeout with its options and preserves options" do - expect(provider).to receive(stubbed_method).with("foo", timeout: 1, env: nil) - provider.send(method, "foo", timeout: 1, env: nil) - end - it "#{method} overrides the new_resource.timeout with the timeout option and preseves options" do - new_resource.timeout(99) - expect(provider).to receive(stubbed_method).with("foo", timeout: 1, env: nil) - provider.send(method, "foo", timeout: 1, env: nil) - end + %i{shell_out shell_out!}.each do |method| + stubbed_method = (method == :shell_out) ? :shell_out_compacted : :shell_out_compacted! + it "#{method} defaults to 900 seconds" do + expect(provider).to receive(stubbed_method).with("foo", timeout: 900) + provider.send(method, "foo") + end + it "#{method} overrides the default timeout with its options" do + expect(provider).to receive(stubbed_method).with("foo", timeout: 1) + provider.send(method, "foo", timeout: 1) + end + it "#{method} overrides the new_resource.timeout with the timeout option" do + new_resource.timeout(99) + expect(provider).to receive(stubbed_method).with("foo", timeout: 1) + provider.send(method, "foo", timeout: 1) + end + it "#{method} defaults to 900 seconds and preserves options" do + expect(provider).to receive(stubbed_method).with("foo", env: nil, timeout: 900) + provider.send(method, "foo", env: nil) + end + it "#{method} overrides the default timeout with its options and preserves options" do + expect(provider).to receive(stubbed_method).with("foo", timeout: 1, env: nil) + provider.send(method, "foo", timeout: 1, env: nil) + end + it "#{method} overrides the new_resource.timeout with the timeout option and preseves options" do + new_resource.timeout(99) + expect(provider).to receive(stubbed_method).with("foo", timeout: 1, env: nil) + provider.send(method, "foo", timeout: 1, env: nil) end end end |