Skip to content

Commit 4c433fd

Browse files
committed
Also support the restart service by default, and add specs to this effect
1 parent e8cd52d commit 4c433fd

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

chef/lib/chef/provider/service/gentoo.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class Gentoo < Chef::Provider::Service::Init
2626
def load_current_resource
2727

2828
@new_resource.supports[:status] = true
29+
@new_resource.supports[:restart] = true
2930

3031
super
3132

chef/spec/unit/provider/service/gentoo_service_spec.rb

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
before(:each) do
2323
@node = mock("Chef::Node", :null_object => true)
2424

25-
resource_opts = { :null_object => true, :name => 'chef', :service_name => 'chef', :enabled => false, :running => nil }
25+
resource_opts = { :null_object => true, :name => 'chef', :service_name => 'chef', :enabled => false, :running => nil, :supports => {} }
2626
@new_resource = mock("Chef::Resource::Service", resource_opts)
2727
@current_resource = mock("Chef::Resource::Service", resource_opts)
2828

@@ -70,6 +70,22 @@
7070
it "should return the current_resource" do
7171
@provider.load_current_resource.should == @current_resource
7272
end
73+
74+
it "should support the status command automatically" do
75+
@provider.load_current_resource
76+
@new_resource.supports[:status].should be_true
77+
end
78+
79+
it "should support the restart command automatically" do
80+
@provider.load_current_resource
81+
@new_resource.supports[:restart].should be_true
82+
end
83+
84+
it "should not support the reload command automatically" do
85+
@provider.load_current_resource
86+
@new_resource.supports[:reload].should_not be_true
87+
end
88+
7389
end
7490

7591
describe "action_methods" do
@@ -89,4 +105,5 @@
89105
end
90106
end
91107
end
108+
92109
end

0 commit comments

Comments
 (0)