summaryrefslogtreecommitdiff
path: root/spec/unit/provider/service
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2016-01-14 14:08:03 +0000
committerThom May <thom@chef.io>2016-01-14 14:08:03 +0000
commit51cfbdc4d16739caac4d946fadbe678444aafe34 (patch)
tree56dfd8f1cd9fd933de27268b32402e955a43ac2b /spec/unit/provider/service
parent05064423057d4cf46f4713b81b08829cf6d20af6 (diff)
downloadchef-51cfbdc4d16739caac4d946fadbe678444aafe34.tar.gz
Use double quotes by default
This is an entirely mechanically generated (chefstyle -a) change, to go along with chef/chefstyle#5 . We should pick something and use it consistently, and my opinion is that double quotes are the appropriate thing.
Diffstat (limited to 'spec/unit/provider/service')
-rw-r--r--spec/unit/provider/service/aix_service_spec.rb8
-rw-r--r--spec/unit/provider/service/aixinit_service_spec.rb24
-rw-r--r--spec/unit/provider/service/arch_service_spec.rb12
-rw-r--r--spec/unit/provider/service/debian_service_spec.rb4
-rw-r--r--spec/unit/provider/service/freebsd_service_spec.rb2
-rw-r--r--spec/unit/provider/service/gentoo_service_spec.rb2
-rw-r--r--spec/unit/provider/service/init_service_spec.rb4
-rw-r--r--spec/unit/provider/service/insserv_service_spec.rb2
-rw-r--r--spec/unit/provider/service/invokercd_service_spec.rb4
-rw-r--r--spec/unit/provider/service/macosx_spec.rb26
-rw-r--r--spec/unit/provider/service/openbsd_service_spec.rb40
-rw-r--r--spec/unit/provider/service/redhat_spec.rb4
-rw-r--r--spec/unit/provider/service/simple_service_spec.rb2
-rw-r--r--spec/unit/provider/service/solaris_smf_service_spec.rb76
-rw-r--r--spec/unit/provider/service/systemd_service_spec.rb6
-rw-r--r--spec/unit/provider/service/upstart_service_spec.rb20
-rw-r--r--spec/unit/provider/service/windows_spec.rb12
17 files changed, 124 insertions, 124 deletions
diff --git a/spec/unit/provider/service/aix_service_spec.rb b/spec/unit/provider/service/aix_service_spec.rb
index 5cca7d6f0a..abfc19d94f 100644
--- a/spec/unit/provider/service/aix_service_spec.rb
+++ b/spec/unit/provider/service/aix_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Aix do
before(:each) do
@@ -133,7 +133,7 @@ describe Chef::Provider::Service::Aix do
end
it "should call the start command for groups" do
- @provider.instance_eval('@is_resource_group = true')
+ @provider.instance_eval("@is_resource_group = true")
expect(@provider).to receive(:shell_out!).with("startsrc -g #{@new_resource.service_name}")
@provider.start_service
@@ -152,7 +152,7 @@ describe Chef::Provider::Service::Aix do
end
it "should call the stop command for groups" do
- @provider.instance_eval('@is_resource_group = true')
+ @provider.instance_eval("@is_resource_group = true")
expect(@provider).to receive(:shell_out!).with("stopsrc -g #{@new_resource.service_name}")
@provider.stop_service
@@ -171,7 +171,7 @@ describe Chef::Provider::Service::Aix do
end
it "should call the reload command for groups" do
- @provider.instance_eval('@is_resource_group = true')
+ @provider.instance_eval("@is_resource_group = true")
expect(@provider).to receive(:shell_out!).with("refresh -g #{@new_resource.service_name}")
@provider.reload_service
diff --git a/spec/unit/provider/service/aixinit_service_spec.rb b/spec/unit/provider/service/aixinit_service_spec.rb
index 9977343daa..9274c3001b 100644
--- a/spec/unit/provider/service/aixinit_service_spec.rb
+++ b/spec/unit/provider/service/aixinit_service_spec.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::AixInit do
before(:each) do
@node = Chef::Node.new
- @node.automatic_attrs[:command] = {:ps => 'fuuuu'}
+ @node.automatic_attrs[:command] = {:ps => "fuuuu"}
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
@@ -102,7 +102,7 @@ describe Chef::Provider::Service::AixInit do
context "when the service doesn't set a priority" do
it "creates symlink with status S" do
- expect(@provider).to receive(:create_symlink).with(2,'S','')
+ expect(@provider).to receive(:create_symlink).with(2,"S","")
@provider.enable_service
end
@@ -114,7 +114,7 @@ describe Chef::Provider::Service::AixInit do
end
it "creates a symlink with status S and a priority" do
- expect(@provider).to receive(:create_symlink).with(2,'S',75)
+ expect(@provider).to receive(:create_symlink).with(2,"S",75)
@provider.enable_service
end
@@ -127,8 +127,8 @@ describe Chef::Provider::Service::AixInit do
end
it "create symlink with status start (S) or stop (K) and a priority " do
- expect(@provider).to receive(:create_symlink).with(2,'S',20)
- expect(@provider).to receive(:create_symlink).with(3,'K',10)
+ expect(@provider).to receive(:create_symlink).with(2,"S",20)
+ expect(@provider).to receive(:create_symlink).with(3,"K",10)
@provider.enable_service
end
@@ -142,7 +142,7 @@ describe Chef::Provider::Service::AixInit do
context "when the service doesn't set a priority" do
it "creates symlinks with status stop (K)" do
- expect(@provider).to receive(:create_symlink).with(2,'K','')
+ expect(@provider).to receive(:create_symlink).with(2,"K","")
@provider.disable_service
end
@@ -154,7 +154,7 @@ describe Chef::Provider::Service::AixInit do
end
it "create symlink with status stop (k) and a priority " do
- expect(@provider).to receive(:create_symlink).with(2,'K',25)
+ expect(@provider).to receive(:create_symlink).with(2,"K",25)
@provider.disable_service
end
@@ -167,7 +167,7 @@ describe Chef::Provider::Service::AixInit do
end
it "create symlink with status stop (k) and a priority " do
- expect(@provider).to receive(:create_symlink).with(3,'K',90)
+ expect(@provider).to receive(:create_symlink).with(3,"K",90)
@provider.disable_service
end
@@ -231,7 +231,7 @@ describe Chef::Provider::Service::AixInit do
it "the service is enabled" do
expect(@provider.current_resource).to receive(:enabled).with(true)
- expect(@provider.current_resource).to receive(:priority).with('')
+ expect(@provider.current_resource).to receive(:priority).with("")
@provider.set_current_resource_attributes
end
@@ -240,7 +240,7 @@ describe Chef::Provider::Service::AixInit do
context "when rc2.d contains only stop script (without priority)" do
before do
files = ["/etc/rc.d/rc2.d/Kapache"]
- @priority = {2 => [:stop, '']}
+ @priority = {2 => [:stop, ""]}
allow(Dir).to receive(:glob).with(["/etc/rc.d/rc2.d/[SK][0-9][0-9]#{@new_resource.service_name}", "/etc/rc.d/rc2.d/[SK]#{@new_resource.service_name}"]).and_return(files)
end
@@ -257,7 +257,7 @@ describe Chef::Provider::Service::AixInit do
files = ["/etc/rc.d/rc2.d/Sapache", "/etc/rc.d/rc2.d/Kapache"]
# FIXME: this is clearly buggy the duplicated keys do not work
#@priority = {2 => [:start, ''], 2 => [:stop, '']}
- @priority = {2 => [:stop, '']}
+ @priority = {2 => [:stop, ""]}
allow(Dir).to receive(:glob).with(["/etc/rc.d/rc2.d/[SK][0-9][0-9]#{@new_resource.service_name}", "/etc/rc.d/rc2.d/[SK]#{@new_resource.service_name}"]).and_return(files)
end
diff --git a/spec/unit/provider/service/arch_service_spec.rb b/spec/unit/provider/service/arch_service_spec.rb
index 49be0e274c..40f87b24bf 100644
--- a/spec/unit/provider/service/arch_service_spec.rb
+++ b/spec/unit/provider/service/arch_service_spec.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+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.
@@ -45,7 +45,7 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do
it "should set the current resources service name to the new resources service name" do
allow(@provider).to receive(:shell_out).and_return(OpenStruct.new(:exitstatus => 0, :stdout => ""))
@provider.load_current_resource
- expect(@provider.current_resource.service_name).to eq('chef')
+ expect(@provider.current_resource.service_name).to eq("chef")
end
end
@@ -155,7 +155,7 @@ RUNNING_PS
it "should return existing entries in DAEMONS array" do
allow(::File).to receive(:read).with("/etc/rc.conf").and_return("DAEMONS=(network !apache ssh)")
- expect(@provider.daemons).to eq(['network', '!apache', 'ssh'])
+ expect(@provider.daemons).to eq(["network", "!apache", "ssh"])
end
context "when the current service status is known" do
@@ -180,7 +180,7 @@ RUNNING_PS
it "should add chef to DAEMONS array" do
allow(::File).to receive(:read).with("/etc/rc.conf").and_return("DAEMONS=(network)")
- expect(@provider).to receive(:update_daemons).with(['network', 'chef'])
+ expect(@provider).to receive(:update_daemons).with(["network", "chef"])
@provider.enable_service()
end
end
@@ -201,7 +201,7 @@ RUNNING_PS
it "should remove chef from DAEMONS array" do
allow(::File).to receive(:read).with("/etc/rc.conf").and_return("DAEMONS=(network chef)")
- expect(@provider).to receive(:update_daemons).with(['network', '!chef'])
+ expect(@provider).to receive(:update_daemons).with(["network", "!chef"])
@provider.disable_service()
end
end
diff --git a/spec/unit/provider/service/debian_service_spec.rb b/spec/unit/provider/service/debian_service_spec.rb
index 346e349db7..79c51d0ea7 100644
--- a/spec/unit/provider/service/debian_service_spec.rb
+++ b/spec/unit/provider/service/debian_service_spec.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Debian do
before(:each) do
@node = Chef::Node.new
- @node.automatic_attrs[:command] = {:ps => 'fuuuu'}
+ @node.automatic_attrs[:command] = {:ps => "fuuuu"}
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
diff --git a/spec/unit/provider/service/freebsd_service_spec.rb b/spec/unit/provider/service/freebsd_service_spec.rb
index cfc28c94d5..5bfa8ff6c0 100644
--- a/spec/unit/provider/service/freebsd_service_spec.rb
+++ b/spec/unit/provider/service/freebsd_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class Chef::Provider::Service::Freebsd
public :service_enable_variable_name
diff --git a/spec/unit/provider/service/gentoo_service_spec.rb b/spec/unit/provider/service/gentoo_service_spec.rb
index b4155f9628..8bfac80002 100644
--- a/spec/unit/provider/service/gentoo_service_spec.rb
+++ b/spec/unit/provider/service/gentoo_service_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Gentoo do
before(:each) do
diff --git a/spec/unit/provider/service/init_service_spec.rb b/spec/unit/provider/service/init_service_spec.rb
index 827a4261e1..2594a732d9 100644
--- a/spec/unit/provider/service/init_service_spec.rb
+++ b/spec/unit/provider/service/init_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Init, "load_current_resource" do
before(:each) do
@@ -48,7 +48,7 @@ PS
it "should set the current resources service name to the new resources service name" do
@provider.load_current_resource
- expect(@current_resource.service_name).to eq('chef')
+ expect(@current_resource.service_name).to eq("chef")
end
describe "when the service supports status" do
diff --git a/spec/unit/provider/service/insserv_service_spec.rb b/spec/unit/provider/service/insserv_service_spec.rb
index 3799daebb4..fccbfac2b3 100644
--- a/spec/unit/provider/service/insserv_service_spec.rb
+++ b/spec/unit/provider/service/insserv_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Insserv do
before(:each) do
diff --git a/spec/unit/provider/service/invokercd_service_spec.rb b/spec/unit/provider/service/invokercd_service_spec.rb
index 81588c80e5..d8d860a291 100644
--- a/spec/unit/provider/service/invokercd_service_spec.rb
+++ b/spec/unit/provider/service/invokercd_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Invokercd, "load_current_resource" do
before(:each) do
@@ -48,7 +48,7 @@ PS
it "should set the current resources service name to the new resources service name" do
@provider.load_current_resource
- expect(@current_resource.service_name).to eq('chef')
+ expect(@current_resource.service_name).to eq("chef")
end
describe "when the service supports status" do
diff --git a/spec/unit/provider/service/macosx_spec.rb b/spec/unit/provider/service/macosx_spec.rb
index 54183bdc3d..c3204700d7 100644
--- a/spec/unit/provider/service/macosx_spec.rb
+++ b/spec/unit/provider/service/macosx_spec.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Macosx do
describe ".gather_plist_dirs" do
context "when HOME directory is set" do
before do
- allow(Chef::Util::PathHelper).to receive(:home).with('Library', 'LaunchAgents').and_yield('/Users/someuser/Library/LaunchAgents')
+ allow(Chef::Util::PathHelper).to receive(:home).with("Library", "LaunchAgents").and_yield("/Users/someuser/Library/LaunchAgents")
end
it "includes users's LaunchAgents folder" do
@@ -32,7 +32,7 @@ describe Chef::Provider::Service::Macosx do
context "when HOME directory is not set" do
before do
- allow(Chef::Util::PathHelper).to receive(:home).with('Library', 'LaunchAgents').and_return(nil)
+ allow(Chef::Util::PathHelper).to receive(:home).with("Library", "LaunchAgents").and_return(nil)
end
it "doesn't include user's LaunchAgents folder" do
@@ -61,20 +61,20 @@ XML
["Daemon", "Agent"].each do |service_type|
["redis-server", "io.redis.redis-server"].each do |service_name|
["10.9", "10.10", "10.11"].each do |platform_version|
- let(:plist) {'/Library/LaunchDaemons/io.redis.redis-server.plist'}
+ let(:plist) {"/Library/LaunchDaemons/io.redis.redis-server.plist"}
let(:session) { StringIO.new }
- if service_type == 'Agent'
- let(:plist) {'/Library/LaunchAgents/io.redis.redis-server.plist'}
- let(:session) {'-S Aqua '}
- let(:su_cmd) {'su -l igor -c'}
+ if service_type == "Agent"
+ let(:plist) {"/Library/LaunchAgents/io.redis.redis-server.plist"}
+ let(:session) {"-S Aqua "}
+ let(:su_cmd) {"su -l igor -c"}
if platform_version == "10.9"
- let(:su_cmd) {'su igor -c'}
+ let(:su_cmd) {"su igor -c"}
end
end
- let(:service_label) {'io.redis.redis-server'}
+ let(:service_label) {"io.redis.redis-server"}
before do
allow(Dir).to receive(:glob).and_return([plist], [])
- allow(Etc).to receive(:getlogin).and_return('igor')
+ allow(Etc).to receive(:getlogin).and_return("igor")
allow(node).to receive(:[]).with("platform_version").and_return(platform_version)
cmd = "launchctl list #{service_label}"
allow(provider).to receive(:shell_out_with_systems_locale).
@@ -263,7 +263,7 @@ SVC_LIST
end
it "starts service via launchctl if service found" do
- cmd = 'launchctl load -w ' + session + plist
+ cmd = "launchctl load -w " + session + plist
expect(provider).to receive(:shell_out_with_systems_locale).
with(/(#{su_cmd} .#{cmd}.|#{cmd})/).
and_return(0)
@@ -295,7 +295,7 @@ SVC_LIST
end
it "stops the service via launchctl if service found" do
- cmd = 'launchctl unload -w '+ plist
+ cmd = "launchctl unload -w "+ plist
expect(provider).to receive(:shell_out_with_systems_locale).
with(/(#{su_cmd} .#{cmd}.|#{cmd})/).
and_return(0)
diff --git a/spec/unit/provider/service/openbsd_service_spec.rb b/spec/unit/provider/service/openbsd_service_spec.rb
index 8118e9b3ee..c08a97e7b1 100644
--- a/spec/unit/provider/service/openbsd_service_spec.rb
+++ b/spec/unit/provider/service/openbsd_service_spec.rb
@@ -18,7 +18,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class Chef::Provider::Service::Openbsd
public :builtin_service_enable_variable_name
@@ -52,8 +52,8 @@ describe Chef::Provider::Service::Openbsd do
let(:provider) do
events = Chef::EventDispatch::Dispatcher.new
run_context = Chef::RunContext.new(node, {}, events)
- allow(::File).to receive(:read).with('/etc/rc.conf').and_return('')
- allow(::File).to receive(:read).with('/etc/rc.conf.local').and_return('')
+ allow(::File).to receive(:read).with("/etc/rc.conf").and_return("")
+ allow(::File).to receive(:read).with("/etc/rc.conf.local").and_return("")
provider = Chef::Provider::Service::Openbsd.new(new_resource,run_context)
provider.action = :start
provider
@@ -80,7 +80,7 @@ describe Chef::Provider::Service::Openbsd do
end
it "should set init_command to nil if it can't find anything" do
- expect(::File).to receive(:exist?).with('/etc/rc.d/sndiod').and_return(false)
+ expect(::File).to receive(:exist?).with("/etc/rc.d/sndiod").and_return(false)
expect(provider.init_command).to be nil
end
end
@@ -381,7 +381,7 @@ describe Chef::Provider::Service::Openbsd do
describe Chef::Provider::Service::Openbsd, "enable_service" do
before do
provider.current_resource = current_resource
- allow(FileUtils).to receive(:touch).with('/etc/rc.conf.local')
+ allow(FileUtils).to receive(:touch).with("/etc/rc.conf.local")
end
context "is builtin and disabled by default" do
before do
@@ -398,10 +398,10 @@ describe Chef::Provider::Service::Openbsd do
end
context "is disabled" do
before do
- provider.rc_conf_local = ''
+ provider.rc_conf_local = ""
end
it "should enable the service by adding a line to rc.conf.local" do
- expect(::File).to receive(:write).with('/etc/rc.conf.local', include("#{provider.builtin_service_enable_variable_name}=\"\""))
+ expect(::File).to receive(:write).with("/etc/rc.conf.local", include("#{provider.builtin_service_enable_variable_name}=\"\""))
expect(provider.is_enabled?).to be false
provider.enable_service
expect(provider.is_enabled?).to be true
@@ -414,7 +414,7 @@ describe Chef::Provider::Service::Openbsd do
end
context "is enabled" do
before do
- provider.rc_conf_local = ''
+ provider.rc_conf_local = ""
end
it "should not change rc.conf.local since it is already enabled" do
expect(::File).not_to receive(:write)
@@ -426,7 +426,7 @@ describe Chef::Provider::Service::Openbsd do
provider.rc_conf_local = "#{provider.builtin_service_enable_variable_name}=NO"
end
it "should enable the service by removing a line from rc.conf.local" do
- expect(::File).to receive(:write).with('/etc/rc.conf.local', /^(?!#{provider.builtin_service_enable_variable_name})$/)
+ expect(::File).to receive(:write).with("/etc/rc.conf.local", /^(?!#{provider.builtin_service_enable_variable_name})$/)
expect(provider.is_enabled?).to be false
provider.enable_service
expect(provider.is_enabled?).to be true
@@ -435,7 +435,7 @@ describe Chef::Provider::Service::Openbsd do
end
context "is not builtin" do
before do
- provider.rc_conf = ''
+ provider.rc_conf = ""
end
context "is enabled" do
before do
@@ -448,10 +448,10 @@ describe Chef::Provider::Service::Openbsd do
end
context "is disabled" do
before do
- provider.rc_conf_local = ''
+ provider.rc_conf_local = ""
end
it "should enable the service by adding it to the pkg_scripts list" do
- expect(::File).to receive(:write).with('/etc/rc.conf.local', "\npkg_scripts=\"#{new_resource.service_name}\"\n")
+ expect(::File).to receive(:write).with("/etc/rc.conf.local", "\npkg_scripts=\"#{new_resource.service_name}\"\n")
expect(provider.is_enabled?).to be false
provider.enable_service
expect(provider.is_enabled?).to be true
@@ -463,7 +463,7 @@ describe Chef::Provider::Service::Openbsd do
describe Chef::Provider::Service::Openbsd, "disable_service" do
before do
provider.current_resource = current_resource
- allow(FileUtils).to receive(:touch).with('/etc/rc.conf.local')
+ allow(FileUtils).to receive(:touch).with("/etc/rc.conf.local")
end
context "is builtin and disabled by default" do
before do
@@ -474,7 +474,7 @@ describe Chef::Provider::Service::Openbsd do
provider.rc_conf_local = "#{provider.builtin_service_enable_variable_name}=\"\""
end
it "should disable the service by removing its line from rc.conf.local" do
- expect(::File).to receive(:write).with('/etc/rc.conf.local', /^(?!#{provider.builtin_service_enable_variable_name})$/)
+ expect(::File).to receive(:write).with("/etc/rc.conf.local", /^(?!#{provider.builtin_service_enable_variable_name})$/)
expect(provider.is_enabled?).to be true
provider.disable_service
expect(provider.is_enabled?).to be false
@@ -482,7 +482,7 @@ describe Chef::Provider::Service::Openbsd do
end
context "is disabled" do
before do
- provider.rc_conf_local = ''
+ provider.rc_conf_local = ""
end
it "should not change rc.conf.local since it is already disabled" do
expect(::File).not_to receive(:write)
@@ -496,10 +496,10 @@ describe Chef::Provider::Service::Openbsd do
end
context "is enabled" do
before do
- provider.rc_conf_local = ''
+ provider.rc_conf_local = ""
end
it "should disable the service by adding a line to rc.conf.local" do
- expect(::File).to receive(:write).with('/etc/rc.conf.local', include("#{provider.builtin_service_enable_variable_name}=\"NO\""))
+ expect(::File).to receive(:write).with("/etc/rc.conf.local", include("#{provider.builtin_service_enable_variable_name}=\"NO\""))
expect(provider.is_enabled?).to be true
provider.disable_service
expect(provider.is_enabled?).to be false
@@ -517,14 +517,14 @@ describe Chef::Provider::Service::Openbsd do
end
context "is not builtin" do
before do
- provider.rc_conf = ''
+ provider.rc_conf = ""
end
context "is enabled" do
before do
provider.rc_conf_local = "pkg_scripts=\"#{new_resource.service_name}\"\n"
end
it "should disable the service by removing it from the pkg_scripts list" do
- expect(::File).to receive(:write).with('/etc/rc.conf.local', /^(?!#{new_resource.service_name})$/)
+ expect(::File).to receive(:write).with("/etc/rc.conf.local", /^(?!#{new_resource.service_name})$/)
expect(provider.is_enabled?).to be true
provider.disable_service
expect(provider.is_enabled?).to be false
@@ -532,7 +532,7 @@ describe Chef::Provider::Service::Openbsd do
end
context "is disabled" do
before do
- provider.rc_conf_local = ''
+ provider.rc_conf_local = ""
end
it "should not change rc.conf.local since it is already disabled" do
expect(::File).not_to receive(:write)
diff --git a/spec/unit/provider/service/redhat_spec.rb b/spec/unit/provider/service/redhat_spec.rb
index 5aaf54d9f5..d79e179898 100644
--- a/spec/unit/provider/service/redhat_spec.rb
+++ b/spec/unit/provider/service/redhat_spec.rb
@@ -17,7 +17,7 @@
#
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "spec_helper"))
-require 'ostruct'
+require "ostruct"
shared_examples_for "define_resource_requirements_common" do
it "should raise an error if /sbin/chkconfig does not exist" do
@@ -44,7 +44,7 @@ describe "Chef::Provider::Service::Redhat" do
before(:each) do
@node = Chef::Node.new
- @node.automatic_attrs[:command] = {:ps => 'foo'}
+ @node.automatic_attrs[:command] = {:ps => "foo"}
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
diff --git a/spec/unit/provider/service/simple_service_spec.rb b/spec/unit/provider/service/simple_service_spec.rb
index 895c559dff..ef5fe55a49 100644
--- a/spec/unit/provider/service/simple_service_spec.rb
+++ b/spec/unit/provider/service/simple_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Simple, "load_current_resource" do
before(:each) do
diff --git a/spec/unit/provider/service/solaris_smf_service_spec.rb b/spec/unit/provider/service/solaris_smf_service_spec.rb
index 4ff3e89ae3..a5f54f0830 100644
--- a/spec/unit/provider/service/solaris_smf_service_spec.rb
+++ b/spec/unit/provider/service/solaris_smf_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Solaris do
before(:each) do
@@ -24,69 +24,69 @@ describe Chef::Provider::Service::Solaris do
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
- @new_resource = Chef::Resource::Service.new('chef')
+ @new_resource = Chef::Resource::Service.new("chef")
- @current_resource = Chef::Resource::Service.new('chef')
+ @current_resource = Chef::Resource::Service.new("chef")
@provider = Chef::Provider::Service::Solaris.new(@new_resource, @run_context)
allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource)
# enabled / started service (svcs -l chef)
enabled_svc_stdout = [
- 'fmri svc:/application/chef:default',
- 'name chef service',
- 'enabled true',
- 'state online',
- 'next_state none',
- 'state_time April 2, 2015 04:25:19 PM EDT',
- 'logfile /var/svc/log/application-chef:default.log',
- 'restarter svc:/system/svc/restarter:default',
- 'contract_id 1115271',
- 'dependency require_all/error svc:/milestone/multi-user:default (online)',
+ "fmri svc:/application/chef:default",
+ "name chef service",
+ "enabled true",
+ "state online",
+ "next_state none",
+ "state_time April 2, 2015 04:25:19 PM EDT",
+ "logfile /var/svc/log/application-chef:default.log",
+ "restarter svc:/system/svc/restarter:default",
+ "contract_id 1115271",
+ "dependency require_all/error svc:/milestone/multi-user:default (online)",
].join("\n")
# disabled / stopped service (svcs -l chef)
disabled_svc_stdout = [
- 'fmri svc:/application/chef:default',
- 'name chef service',
- 'enabled false',
- 'state disabled',
- 'next_state none',
- 'state_time April 2, 2015 04:25:19 PM EDT',
- 'logfile /var/svc/log/application-chef:default.log',
- 'restarter svc:/system/svc/restarter:default',
- 'contract_id 1115271',
- 'dependency require_all/error svc:/milestone/multi-user:default (online)',
+ "fmri svc:/application/chef:default",
+ "name chef service",
+ "enabled false",
+ "state disabled",
+ "next_state none",
+ "state_time April 2, 2015 04:25:19 PM EDT",
+ "logfile /var/svc/log/application-chef:default.log",
+ "restarter svc:/system/svc/restarter:default",
+ "contract_id 1115271",
+ "dependency require_all/error svc:/milestone/multi-user:default (online)",
].join("\n")
# disabled / stopped service (svcs -l chef)
maintenance_svc_stdout = [
- 'fmri svc:/application/chef:default',
- 'name chef service',
- 'enabled true',
- 'state maintenance',
- 'next_state none',
- 'state_time April 2, 2015 04:25:19 PM EDT',
- 'logfile /var/svc/log/application-chef:default.log',
- 'restarter svc:/system/svc/restarter:default',
- 'contract_id 1115271',
- 'dependency require_all/error svc:/milestone/multi-user:default (online)',
+ "fmri svc:/application/chef:default",
+ "name chef service",
+ "enabled true",
+ "state maintenance",
+ "next_state none",
+ "state_time April 2, 2015 04:25:19 PM EDT",
+ "logfile /var/svc/log/application-chef:default.log",
+ "restarter svc:/system/svc/restarter:default",
+ "contract_id 1115271",
+ "dependency require_all/error svc:/milestone/multi-user:default (online)",
].join("\n")
# shell_out! return value for a service that is running
- @enabled_svc_status = double("Status", :exitstatus => 0, :stdout => enabled_svc_stdout, :stdin => '', :stderr => '')
+ @enabled_svc_status = double("Status", :exitstatus => 0, :stdout => enabled_svc_stdout, :stdin => "", :stderr => "")
# shell_out! return value for a service that is disabled
- @disabled_svc_status = double("Status", :exitstatus => 0, :stdout => disabled_svc_stdout, :stdin => '', :stderr => '')
+ @disabled_svc_status = double("Status", :exitstatus => 0, :stdout => disabled_svc_stdout, :stdin => "", :stderr => "")
# shell_out! return value for a service that is in maintenance mode
- @maintenance_svc_status = double("Status", :exitstatus => 0, :stdout => maintenance_svc_stdout, :stdin => '', :stderr => '')
+ @maintenance_svc_status = double("Status", :exitstatus => 0, :stdout => maintenance_svc_stdout, :stdin => "", :stderr => "")
# shell_out! return value for a service that does not exist
- @no_svc_status = double("Status", :exitstatus => 1, :stdout => '', :stdin => '', :stderr => "svcs: Pattern 'chef' doesn't match any instances\n")
+ @no_svc_status = double("Status", :exitstatus => 1, :stdout => "", :stdin => "", :stderr => "svcs: Pattern 'chef' doesn't match any instances\n")
# shell_out! return value for a successful execution
- @success = double("clear", :exitstatus => 0, :stdout => '', :stdin => '', :stderr => '')
+ @success = double("clear", :exitstatus => 0, :stdout => "", :stdin => "", :stderr => "")
end
it "should raise an error if /bin/svcs and /usr/sbin/svcadm are not executable" do
diff --git a/spec/unit/provider/service/systemd_service_spec.rb b/spec/unit/provider/service/systemd_service_spec.rb
index 90b669a459..3761eb46db 100644
--- a/spec/unit/provider/service/systemd_service_spec.rb
+++ b/spec/unit/provider/service/systemd_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Systemd do
@@ -33,11 +33,11 @@ describe Chef::Provider::Service::Systemd do
let(:provider) { Chef::Provider::Service::Systemd.new(new_resource, run_context) }
let(:shell_out_success) do
- double('shell_out_with_systems_locale', :exitstatus => 0, :error? => false)
+ double("shell_out_with_systems_locale", :exitstatus => 0, :error? => false)
end
let(:shell_out_failure) do
- double('shell_out_with_systems_locale', :exitstatus => 1, :error? => true)
+ double("shell_out_with_systems_locale", :exitstatus => 1, :error? => true)
end
let(:current_resource) { Chef::Resource::Service.new(service_name) }
diff --git a/spec/unit/provider/service/upstart_service_spec.rb b/spec/unit/provider/service/upstart_service_spec.rb
index 6fb1f9fdbf..8a17e04f1a 100644
--- a/spec/unit/provider/service/upstart_service_spec.rb
+++ b/spec/unit/provider/service/upstart_service_spec.rb
@@ -16,18 +16,18 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Upstart do
let(:shell_out_success) do
- double('shell_out_with_systems_locale', :exitstatus => 0, :error? => false)
+ double("shell_out_with_systems_locale", :exitstatus => 0, :error? => false)
end
before(:each) do
@node =Chef::Node.new
- @node.name('upstarter')
- @node.automatic_attrs[:platform] = 'ubuntu'
- @node.automatic_attrs[:platform_version] = '9.10'
+ @node.name("upstarter")
+ @node.automatic_attrs[:platform] = "ubuntu"
+ @node.automatic_attrs[:platform_version] = "9.10"
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
@@ -42,7 +42,7 @@ describe Chef::Provider::Service::Upstart do
end
it "should return /etc/event.d as the upstart job directory when running on Ubuntu 9.04" do
- @node.automatic_attrs[:platform_version] = '9.04'
+ @node.automatic_attrs[:platform_version] = "9.04"
#Chef::Platform.stub(:find_platform_and_version).and_return([ "ubuntu", "9.04" ])
@provider = Chef::Provider::Service::Upstart.new(@new_resource, @run_context)
expect(@provider.instance_variable_get(:@upstart_job_dir)).to eq("/etc/event.d")
@@ -50,14 +50,14 @@ describe Chef::Provider::Service::Upstart do
end
it "should return /etc/init as the upstart job directory when running on Ubuntu 9.10" do
- @node.automatic_attrs[:platform_version] = '9.10'
+ @node.automatic_attrs[:platform_version] = "9.10"
@provider = Chef::Provider::Service::Upstart.new(@new_resource, @run_context)
expect(@provider.instance_variable_get(:@upstart_job_dir)).to eq("/etc/init")
expect(@provider.instance_variable_get(:@upstart_conf_suffix)).to eq(".conf")
end
it "should return /etc/init as the upstart job directory by default" do
- @node.automatic_attrs[:platform_version] = '9000'
+ @node.automatic_attrs[:platform_version] = "9000"
@provider = Chef::Provider::Service::Upstart.new(@new_resource, @run_context)
expect(@provider.instance_variable_get(:@upstart_job_dir)).to eq("/etc/init")
expect(@provider.instance_variable_get(:@upstart_conf_suffix)).to eq(".conf")
@@ -228,7 +228,7 @@ describe Chef::Provider::Service::Upstart do
describe "enable and disable service" do
before(:each) do
- @current_resource = Chef::Resource::Service.new('rsyslog')
+ @current_resource = Chef::Resource::Service.new("rsyslog")
allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource)
@provider.current_resource = @current_resource
allow(Chef::Util::FileEdit).to receive(:new)
@@ -256,7 +256,7 @@ describe Chef::Provider::Service::Upstart do
describe "start and stop service" do
before(:each) do
- @current_resource = Chef::Resource::Service.new('rsyslog')
+ @current_resource = Chef::Resource::Service.new("rsyslog")
allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource)
@provider.current_resource = @current_resource
diff --git a/spec/unit/provider/service/windows_spec.rb b/spec/unit/provider/service/windows_spec.rb
index 34140fdd7b..d478192c78 100644
--- a/spec/unit/provider/service/windows_spec.rb
+++ b/spec/unit/provider/service/windows_spec.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'mixlib/shellout'
+require "spec_helper"
+require "mixlib/shellout"
describe Chef::Provider::Service::Windows, "load_current_resource" do
include_context "Win32"
@@ -51,14 +51,14 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do
end
after(:each) do
- Win32::Service.send(:remove_const, 'AUTO_START') if defined?(Win32::Service::AUTO_START)
- Win32::Service.send(:remove_const, 'DEMAND_START') if defined?(Win32::Service::DEMAND_START)
- Win32::Service.send(:remove_const, 'DISABLED') if defined?(Win32::Service::DISABLED)
+ Win32::Service.send(:remove_const, "AUTO_START") if defined?(Win32::Service::AUTO_START)
+ Win32::Service.send(:remove_const, "DEMAND_START") if defined?(Win32::Service::DEMAND_START)
+ Win32::Service.send(:remove_const, "DISABLED") if defined?(Win32::Service::DISABLED)
end
it "sets the current resources service name to the new resources service name" do
provider.load_current_resource
- expect(provider.current_resource.service_name).to eq('chef')
+ expect(provider.current_resource.service_name).to eq("chef")
end
it "returns the current resource" do