diff options
author | Caleb Tennis <caleb.tennis@gmail.com> | 2012-11-29 08:22:39 -0500 |
---|---|---|
committer | Caleb Tennis <caleb.tennis@gmail.com> | 2012-11-29 08:22:39 -0500 |
commit | 706a748404107eff715b3cea16d47e89da648886 (patch) | |
tree | eb1d0f7daa6f68223d872e63bebebe1dc6d0345c /spec/unit/resource/service_spec.rb | |
parent | 70f80b20f7da71f05f9c8dc0ad9c25312f61b511 (diff) | |
download | chef-706a748404107eff715b3cea16d47e89da648886.tar.gz |
Add support for automatically using the Systemd service provider if it's in use
Diffstat (limited to 'spec/unit/resource/service_spec.rb')
-rw-r--r-- | spec/unit/resource/service_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/unit/resource/service_spec.rb b/spec/unit/resource/service_spec.rb index c06eb9dd77..c9c3e7ce5d 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") |