summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerdar Sutay <serdar@opscode.com>2014-08-12 17:06:47 -0700
committerSerdar Sutay <serdar@opscode.com>2014-08-12 17:06:47 -0700
commit12d245e27537eceff5d6d3c3250dbf39637fae7e (patch)
tree5775659614f9bbb6c51889b402cb6c23b1388691
parentf21b980b6d51d5e159f3c7940c36d11e3230fbf8 (diff)
parent0c90f9868fb8a4576145645ca507f2452286ded3 (diff)
downloadchef-12d245e27537eceff5d6d3c3250dbf39637fae7e.tar.gz
Merge pull request #1814 from opscode/sersut/travis-fix
Do not use :Win32 outside of let, describe, it blocks since we don't have it ready yet.
-rw-r--r--spec/unit/provider/service/windows_spec.rb21
1 files 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