Skip to content

Commit e270529

Browse files
committed
Merge branch 'chef-71' of git://github.com/btm/chef into integration
2 parents ca46fa9 + 8cf27d5 commit e270529

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

chef/lib/chef/resource/service.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,16 @@ def running(arg=nil)
118118
)
119119
end
120120

121+
def supports(args={})
122+
if args.is_a? Array
123+
args.each { |arg| @supports[arg] = true }
124+
elsif args.any?
125+
@supports = args
126+
else
127+
@supports
128+
end
129+
end
130+
121131

122132
end
123133
end

chef/spec/unit/resource/service_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,23 @@
122122
it "should not accept a string for #{attrib}" do
123123
lambda { @resource.send(attrib, "poop") }.should raise_error(ArgumentError)
124124
end
125+
126+
it "should default all the feature support to false" do
127+
support_hash = { :status => false, :restart => false, :reload=> false }
128+
@resource.supports.should eql(support_hash)
129+
end
130+
131+
it "should allow you to set what features this resource supports as a array" do
132+
support_array = [ :status, :restart ]
133+
support_hash = { :status => true, :restart => true, :reload => false }
134+
@resource.supports(support_array)
135+
@resource.supports.should eql(support_hash)
136+
end
137+
138+
it "should allow you to set what features this resource supports as a hash" do
139+
support_hash = { :status => true, :restart => true, :reload => false }
140+
@resource.supports(support_hash)
141+
@resource.supports.should eql(support_hash)
142+
end
125143
end
126144
end

0 commit comments

Comments
 (0)