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