summaryrefslogtreecommitdiff
path: root/spec/unit/resource/service_spec.rb
diff options
context:
space:
mode:
authorClaire McQuin <mcquin@users.noreply.github.com>2014-06-18 15:50:54 -0700
committerClaire McQuin <mcquin@users.noreply.github.com>2014-06-18 15:50:54 -0700
commitaa3378a28a4135ea75198c5872989c50550cfdbd (patch)
tree6d06e5e96c489cae60f6b1ca5f19400e677cf165 /spec/unit/resource/service_spec.rb
parentd8592902ae09980552f8dd57abe9ed9c76851445 (diff)
parent706a748404107eff715b3cea16d47e89da648886 (diff)
downloadchef-aa3378a28a4135ea75198c5872989c50550cfdbd.tar.gz
Merge pull request #506 from ctennis/CHEF-3637
[CHEF-3637] Add support for automatically using the Systemd service provider
Diffstat (limited to 'spec/unit/resource/service_spec.rb')
-rw-r--r--spec/unit/resource/service_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/unit/resource/service_spec.rb b/spec/unit/resource/service_spec.rb
index 067fa7d0d3..ec62d012bb 100644
--- a/spec/unit/resource/service_spec.rb
+++ b/spec/unit/resource/service_spec.rb
@@ -29,6 +29,20 @@ describe Chef::Resource::Service do
@resource.should be_a_kind_of(Chef::Resource)
@resource.should be_a_kind_of(Chef::Resource::Service)
end
+
+ it "should not set a provider unless node[:init_package] is defined as systemd" do
+ @resource.provider.should == nil
+ end
+
+ it "should set the provider to Chef::Provider::Service::Systemd if node[:init_package] is systemd" do
+ node = Chef::Node.new
+ node.set[:init_package] = "systemd"
+ cookbook_collection = Chef::CookbookCollection.new([])
+ events = Chef::EventDispatch::Dispatcher.new
+ run_context = Chef::RunContext.new(node, cookbook_collection, events)
+ @resource = Chef::Resource::Service.new("chef", run_context)
+ @resource.provider.should == Chef::Provider::Service::Systemd
+ end
it "should set the service_name to the first argument to new" do
@resource.service_name.should eql("chef")