diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-09-03 14:16:25 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-09-08 11:10:06 -0700 |
commit | 7b0000f944361a378bcafa8560f74b02c51e594c (patch) | |
tree | 8e391a099d53ed9af968ad015af1e67fd66c8aae | |
parent | 569233d7d302a2eba7f10cd96ca7196114197a0c (diff) | |
download | chef-7b0000f944361a378bcafa8560f74b02c51e594c.tar.gz |
spec fixes for arch service
-rw-r--r-- | spec/unit/provider/service/arch_service_spec.rb | 22 | ||||
-rw-r--r-- | spec/unit/provider/service/debian_service_spec.rb | 2 |
2 files changed, 9 insertions, 15 deletions
diff --git a/spec/unit/provider/service/arch_service_spec.rb b/spec/unit/provider/service/arch_service_spec.rb index b267915e44..38ed74cdee 100644 --- a/spec/unit/provider/service/arch_service_spec.rb +++ b/spec/unit/provider/service/arch_service_spec.rb @@ -20,7 +20,6 @@ require 'spec_helper' require 'ostruct' - # most of this code has been ripped from init_service_spec.rb # and is only slightly modified to match "arch" needs. @@ -36,7 +35,6 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do @new_resource.pattern("chef") @new_resource.supports({:status => false}) - @provider = Chef::Provider::Service::Arch.new(@new_resource, @run_context) ::File.stub(:exists?).with("/etc/rc.conf").and_return(true) @@ -51,7 +49,6 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do end end - describe "when the service supports status" do before do @new_resource.supports({:status => true}) @@ -82,7 +79,6 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do end - describe "when a status command has been specified" do before do @new_resource.status_command("/etc/rc.d/chefhasmonkeypants status") @@ -109,7 +105,6 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service) end - it "should fail if file /etc/rc.conf does not exist" do ::File.stub(:exists?).with("/etc/rc.conf").and_return(false) lambda { @provider.load_current_resource }.should raise_error(Chef::Exceptions::Service) @@ -211,7 +206,6 @@ RUNNING_PS end end - describe Chef::Provider::Service::Arch, "start_service" do # before(:each) do # @new_resource = double("Chef::Resource::Service", @@ -228,12 +222,12 @@ RUNNING_PS it "should call the start command if one is specified" do @new_resource.stub(:start_command).and_return("/etc/rc.d/chef startyousillysally") - @provider.should_receive(:shell_out!).with("/etc/rc.d/chef startyousillysally") + @provider.should_receive(:shell_out_with_systems_locale!).with("/etc/rc.d/chef startyousillysally") @provider.start_service() end it "should call '/etc/rc.d/service_name start' if no start command is specified" do - @provider.should_receive(:shell_out!).with("/etc/rc.d/#{@new_resource.service_name} start") + @provider.should_receive(:shell_out_with_systems_locale!).with("/etc/rc.d/#{@new_resource.service_name} start") @provider.start_service() end end @@ -254,12 +248,12 @@ RUNNING_PS it "should call the stop command if one is specified" do @new_resource.stub(:stop_command).and_return("/etc/rc.d/chef itoldyoutostop") - @provider.should_receive(:shell_out!).with("/etc/rc.d/chef itoldyoutostop") + @provider.should_receive(:shell_out_with_systems_locale!).with("/etc/rc.d/chef itoldyoutostop") @provider.stop_service() end it "should call '/etc/rc.d/service_name stop' if no stop command is specified" do - @provider.should_receive(:shell_out!).with("/etc/rc.d/#{@new_resource.service_name} stop") + @provider.should_receive(:shell_out_with_systems_locale!).with("/etc/rc.d/#{@new_resource.service_name} stop") @provider.stop_service() end end @@ -281,13 +275,13 @@ RUNNING_PS it "should call 'restart' on the service_name if the resource supports it" do @new_resource.stub(:supports).and_return({:restart => true}) - @provider.should_receive(:shell_out!).with("/etc/rc.d/#{@new_resource.service_name} restart") + @provider.should_receive(:shell_out_with_systems_locale!).with("/etc/rc.d/#{@new_resource.service_name} restart") @provider.restart_service() end it "should call the restart_command if one has been specified" do @new_resource.stub(:restart_command).and_return("/etc/rc.d/chef restartinafire") - @provider.should_receive(:shell_out!).with("/etc/rc.d/#{@new_resource.service_name} restartinafire") + @provider.should_receive(:shell_out_with_systems_locale!).with("/etc/rc.d/#{@new_resource.service_name} restartinafire") @provider.restart_service() end @@ -316,13 +310,13 @@ RUNNING_PS it "should call 'reload' on the service if it supports it" do @new_resource.stub(:supports).and_return({:reload => true}) - @provider.should_receive(:shell_out!).with("/etc/rc.d/#{@new_resource.service_name} reload") + @provider.should_receive(:shell_out_with_systems_locale!).with("/etc/rc.d/#{@new_resource.service_name} reload") @provider.reload_service() end it "should should run the user specified reload command if one is specified and the service doesn't support reload" do @new_resource.stub(:reload_command).and_return("/etc/rc.d/chef lollerpants") - @provider.should_receive(:shell_out!).with("/etc/rc.d/#{@new_resource.service_name} lollerpants") + @provider.should_receive(:shell_out_with_systems_locale!).with("/etc/rc.d/#{@new_resource.service_name} lollerpants") @provider.reload_service() end end diff --git a/spec/unit/provider/service/debian_service_spec.rb b/spec/unit/provider/service/debian_service_spec.rb index 567eb6744a..3e60857cbf 100644 --- a/spec/unit/provider/service/debian_service_spec.rb +++ b/spec/unit/provider/service/debian_service_spec.rb @@ -301,7 +301,7 @@ insserv: dryrun, not creating .depend.boot, .depend.start, and .depend.stop def expect_commands(provider, commands) commands.each do |command| - provider.should_receive(:run_command).with({:command => command}) + provider.should_receive(:shell_out!).with(command) end end |