diff options
Diffstat (limited to 'spec/unit/provider')
-rw-r--r-- | spec/unit/provider/service/windows_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/unit/provider/service/windows_spec.rb b/spec/unit/provider/service/windows_spec.rb index 501301926a..00258f3a64 100644 --- a/spec/unit/provider/service/windows_spec.rb +++ b/spec/unit/provider/service/windows_spec.rb @@ -511,6 +511,31 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl double("StatusStruct", current_state: "running")) end + context "run_as_user user is specified" do + let(:run_as_user) { provider.new_resource.class.properties[:run_as_user].default } + + before do + provider.new_resource.run_as_user run_as_user + end + + it "configures service run_as_user and run_as_password" do + expect(provider).to receive(:configure_service_run_as_properties).and_call_original + expect(Win32::Service).to receive(:configure) + provider.start_service + end + end + + context "run_as_user user is not specified" do + before do + expect(provider.new_resource.property_is_set?(:run_as_user)).to be false + end + + it "does not configure service run_as_user and run_as_password" do + expect(Win32::Service).not_to receive(:configure) + provider.start_service + end + end + context "start_command is specified" do let(:start_command) { "sc start #{chef_service_name}" } |