Class: Chef::Resource::Service

Inherits:
Chef::Resource show all
Defined in:
lib/chef/handler/resources/service.rb

Instance Method Summary collapse

Instance Method Details

#to_serverspecObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/chef/handler/resources/service.rb', line 6

def to_serverspec
  ERB.new(
    "\n  describe service('<%= name %>') do\n<%- if action.include? :enable -%>\n    it { should be_enabled }\n<%- end -%>\n<%- if action.include? :disable -%>\n    it { should_not be_enabled }\n<%- end -%>\n<%- if action.include? :start -%>\n    it { should be_running }\n<%- end -%>\n<%- if action.include? :stop -%>\n    it { should_not be_running }\n<%- end -%>\n  end\n",
    safe_level = nil, trim_mode = '-').result(binding)
end