From 0c90f9868fb8a4576145645ca507f2452286ded3 Mon Sep 17 00:00:00 2001 From: Serdar Sutay Date: Tue, 12 Aug 2014 16:16:34 -0700 Subject: Do not use :Win32 outside of let, describe, it blocks since we don't have it ready yet. --- spec/unit/provider/service/windows_spec.rb | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/spec/unit/provider/service/windows_spec.rb b/spec/unit/provider/service/windows_spec.rb index b16c59189b..14bdb782cd 100644 --- a/spec/unit/provider/service/windows_spec.rb +++ b/spec/unit/provider/service/windows_spec.rb @@ -345,14 +345,19 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do end describe Chef::Provider::Service::Windows, "set_start_type" do - allowed_types = { :automatic => Win32::Service::AUTO_START, - :manual => Win32::Service::DEMAND_START, - :disabled => Win32::Service::DISABLED } - allowed_types.each do |arg,win32_constant| - it "when called with #{arg} it calls Win32::Service#configure with #{win32_constant}" do - Win32::Service.should_receive(:configure).with(:service_name => @new_resource.service_name, :start_type => win32_constant) - @provider.send(:set_startup_type, arg) - end + it "when called with :automatic it calls Win32::Service#configure with Win32::Service::AUTO_START" do + Win32::Service.should_receive(:configure).with(:service_name => @new_resource.service_name, :start_type => Win32::Service::AUTO_START) + @provider.send(:set_startup_type, :automatic) + end + + it "when called with :manual it calls Win32::Service#configure with Win32::Service::DEMAND_START" do + Win32::Service.should_receive(:configure).with(:service_name => @new_resource.service_name, :start_type => Win32::Service::DEMAND_START) + @provider.send(:set_startup_type, :manual) + end + + it "when called with :disabled it calls Win32::Service#configure with Win32::Service::DISABLED" do + Win32::Service.should_receive(:configure).with(:service_name => @new_resource.service_name, :start_type => Win32::Service::DISABLED) + @provider.send(:set_startup_type, :disabled) end it "raises an exception when given an unknown start type" do -- cgit v1.2.1