Class: Chef::Resource::User

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

Instance Method Summary collapse

Instance Method Details

#to_serverspecObject



4
5
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/user.rb', line 4

def to_serverspec
  ERB.new(
    <<-EOT,

  describe user('#{username}') do
<%- unless action.include? :remove -%>
    it { should exist }
    <%- if uid -%>
    it { should have_uid #{uid} }
    <%- end -%>
    <%- if shell -%>
    it { should have_login_shell '#{shell}' }
    <%- end -%>
    <%- if home -%>
    it { should have_home_directory '#{home}' }
    <%- end -%>
<%- else -%>
it { should_not exist }
<%- end -%>
  end
EOT
    safe_level = nil, trim_mode = '-').result(binding)
end