add integration test for user resource

This commit is contained in:
Christoph Hartmann 2015-10-22 23:54:24 +02:00
parent c177a511fa
commit 191ef73c65

View file

@ -0,0 +1,44 @@
# encoding: utf-8
# root test
if ['centos', 'fedora', 'opensuse', 'debian', 'ubuntu'].include?(os[:family])
userinfo = {
name: 'root',
group: 'root',
uid: 0,
gid: 0,
groups: ["root"],
home: '/root',
shell: '/bin/bash',
}
# different groupset for centos 5
userinfo[:groups] = ["root", "bin", "daemon", "sys", "adm", "disk", "wheel"] if os[:release].to_i == 5
elsif ['freebsd'].include?(os[:family])
userinfo = {
name: 'root',
group: 'wheel',
uid: 0,
gid: 0,
groups: ["wheel", "operator"],
home: '/root',
shell: '/bin/csh',
}
else
userinfo = {}
end
describe user(userinfo[:name]) do
it { should exist }
it { should belong_to_group userinfo[:group] }
its('uid') { should eq userinfo[:uid] }
its('gid') { should eq userinfo[:gid] }
its('group') { should eq userinfo[:group] }
its('groups') { should eq userinfo[:groups] }
its('home') { should eq userinfo[:home] }
its('shell') { should eq userinfo[:shell] }
end