summaryrefslogtreecommitdiff
path: root/spec/unit/provider/service
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2018-07-02 10:32:45 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2018-07-02 10:32:45 -0700
commit0bdd618fc5146dad3fa5a90d10a4b5e608e4663d (patch)
tree54e82256ba2c4d10f6a67164222ae46010e324f4 /spec/unit/provider/service
parentcdad2f684debda15e8cf773185e78f93892eda35 (diff)
downloadchef-0bdd618fc5146dad3fa5a90d10a4b5e608e4663d.tar.gz
fix Style/UnneededInterpolation
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/unit/provider/service')
-rw-r--r--spec/unit/provider/service/macosx_spec.rb6
-rw-r--r--spec/unit/provider/service/openbsd_service_spec.rb2
-rw-r--r--spec/unit/provider/service/simple_service_spec.rb4
-rw-r--r--spec/unit/provider/service/systemd_service_spec.rb10
-rw-r--r--spec/unit/provider/service/windows_spec.rb6
5 files changed, 14 insertions, 14 deletions
diff --git a/spec/unit/provider/service/macosx_spec.rb b/spec/unit/provider/service/macosx_spec.rb
index d6aeed2daf..9864fb0185 100644
--- a/spec/unit/provider/service/macosx_spec.rb
+++ b/spec/unit/provider/service/macosx_spec.rb
@@ -167,7 +167,7 @@ SVC_LIST
describe "running unsupported actions" do
before do
- allow(Dir).to receive(:glob).and_return(["#{plist}"], [])
+ allow(Dir).to receive(:glob).and_return([(plist).to_s], [])
allow(File).to receive(:exists?).and_return([true], [])
end
it "should throw an exception when reload action is attempted" do
@@ -226,7 +226,7 @@ SVC_LIST
context "and plist for service is available" do
before do
- allow(Dir).to receive(:glob).and_return(["#{plist}"], [])
+ allow(Dir).to receive(:glob).and_return([(plist).to_s], [])
provider.load_current_resource
end
@@ -237,7 +237,7 @@ SVC_LIST
describe "and several plists match service name" do
it "throws exception" do
- allow(Dir).to receive(:glob).and_return(["#{plist}",
+ allow(Dir).to receive(:glob).and_return([(plist).to_s,
"/Users/wtf/something.plist"])
provider.load_current_resource
provider.define_resource_requirements
diff --git a/spec/unit/provider/service/openbsd_service_spec.rb b/spec/unit/provider/service/openbsd_service_spec.rb
index 38283f609d..913fddc1cf 100644
--- a/spec/unit/provider/service/openbsd_service_spec.rb
+++ b/spec/unit/provider/service/openbsd_service_spec.rb
@@ -189,7 +189,7 @@ describe Chef::Provider::Service::Openbsd do
let(:lines) do
[
%Q{#{provider.builtin_service_enable_variable_name}_thing="YES"},
- %Q{#{provider.builtin_service_enable_variable_name}},
+ (provider.builtin_service_enable_variable_name).to_s,
] end
it "sets enabled based on the exact match (false)" do
provider.determine_enabled_status!
diff --git a/spec/unit/provider/service/simple_service_spec.rb b/spec/unit/provider/service/simple_service_spec.rb
index 4481a7c0e3..0529462d2f 100644
--- a/spec/unit/provider/service/simple_service_spec.rb
+++ b/spec/unit/provider/service/simple_service_spec.rb
@@ -106,8 +106,8 @@ NOMOCKINGSTRINGSPLZ
describe "when starting the service" do
it "should call the start command if one is specified" do
- @new_resource.start_command("#{@new_resource.start_command}")
- expect(@provider).to receive(:shell_out!).with("#{@new_resource.start_command}", default_env: false)
+ @new_resource.start_command((@new_resource.start_command).to_s)
+ expect(@provider).to receive(:shell_out!).with((@new_resource.start_command).to_s, default_env: false)
@provider.start_service()
end
diff --git a/spec/unit/provider/service/systemd_service_spec.rb b/spec/unit/provider/service/systemd_service_spec.rb
index ccd814a3a9..15b79922b0 100644
--- a/spec/unit/provider/service/systemd_service_spec.rb
+++ b/spec/unit/provider/service/systemd_service_spec.rb
@@ -264,7 +264,7 @@ describe Chef::Provider::Service::Systemd do
before(:each) do
provider.current_resource = current_resource
current_resource.service_name(service_name)
- allow(provider).to receive(:which).with("systemctl").and_return("#{systemctl_path}")
+ allow(provider).to receive(:which).with("systemctl").and_return(systemctl_path.to_s)
end
it "should call '#{systemctl_path} --system enable service_name' to enable the service" do
@@ -282,7 +282,7 @@ describe Chef::Provider::Service::Systemd do
before(:each) do
provider.current_resource = current_resource
current_resource.service_name(service_name)
- allow(provider).to receive(:which).with("systemctl").and_return("#{systemctl_path}")
+ allow(provider).to receive(:which).with("systemctl").and_return(systemctl_path.to_s)
end
it "should call '#{systemctl_path} --system mask service_name' to mask the service" do
@@ -300,7 +300,7 @@ describe Chef::Provider::Service::Systemd do
before(:each) do
provider.current_resource = current_resource
current_resource.service_name(service_name)
- allow(provider).to receive(:which).with("systemctl").and_return("#{systemctl_path}")
+ allow(provider).to receive(:which).with("systemctl").and_return(systemctl_path.to_s)
end
it "should return true if '#{systemctl_path} --system is-active service_name' returns 0" do
@@ -318,7 +318,7 @@ describe Chef::Provider::Service::Systemd do
before(:each) do
provider.current_resource = current_resource
current_resource.service_name(service_name)
- allow(provider).to receive(:which).with("systemctl").and_return("#{systemctl_path}")
+ allow(provider).to receive(:which).with("systemctl").and_return(systemctl_path.to_s)
end
it "should return true if '#{systemctl_path} --system is-enabled service_name' returns 0" do
@@ -336,7 +336,7 @@ describe Chef::Provider::Service::Systemd do
before(:each) do
provider.current_resource = current_resource
current_resource.service_name(service_name)
- allow(provider).to receive(:which).with("systemctl").and_return("#{systemctl_path}")
+ allow(provider).to receive(:which).with("systemctl").and_return(systemctl_path.to_s)
end
it "should return true if '#{systemctl_path} --system is-enabled service_name' returns 'masked' and returns anything except 0" do
diff --git a/spec/unit/provider/service/windows_spec.rb b/spec/unit/provider/service/windows_spec.rb
index 978d180026..dd59089418 100644
--- a/spec/unit/provider/service/windows_spec.rb
+++ b/spec/unit/provider/service/windows_spec.rb
@@ -508,7 +508,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
it "calls the start command if one is specified" do
new_resource.start_command "sc start #{chef_service_name}"
- expect(provider).to receive(:shell_out!).with("#{new_resource.start_command}").and_return("Starting custom service")
+ expect(provider).to receive(:shell_out!).with((new_resource.start_command).to_s).and_return("Starting custom service")
provider.start_service
expect(new_resource.updated_by_last_action?).to be_truthy
end
@@ -603,7 +603,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
it "calls the stop command if one is specified" do
new_resource.stop_command "sc stop #{chef_service_name}"
- expect(provider).to receive(:shell_out!).with("#{new_resource.stop_command}").and_return("Stopping custom service")
+ expect(provider).to receive(:shell_out!).with((new_resource.stop_command).to_s).and_return("Stopping custom service")
provider.stop_service
expect(new_resource.updated_by_last_action?).to be_truthy
end
@@ -676,7 +676,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
it "calls the restart command if one is specified" do
new_resource.restart_command "sc restart"
- expect(provider).to receive(:shell_out!).with("#{new_resource.restart_command}")
+ expect(provider).to receive(:shell_out!).with((new_resource.restart_command).to_s)
provider.restart_service
expect(new_resource.updated_by_last_action?).to be_truthy
end