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(
    <<-EOT,

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