File: user_spec.rb

package info (click to toggle)
ruby-specinfra 2.94.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,448 kB
  • sloc: ruby: 10,538; sh: 4; makefile: 4
file content (35 lines) | stat: -rw-r--r-- 1,471 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
require 'spec_helper'

set :os, { :family => 'darwin' }

describe get_command(:check_user_has_home_directory, 'foo', '/Users/foo') do
  it { should eq "finger foo | grep -E '^Directory' | awk '{ print $2 }' | grep -E '^/Users/foo$'" }
end

describe get_command(:check_user_has_login_shell, 'foo', '/bin/bash') do
  it { should eq "finger foo | grep -E '^Directory' | awk '{ print $4 }' | grep -E '^/bin/bash$'" }
end

describe get_command(:get_user_home_directory, 'foo') do
  it { should eq "finger foo | grep -E '^Directory' | awk '{ print $2 }'" }
end

describe get_command(:update_user_home_directory, 'user', 'dir') do
  it { should eq "dscl . -create /Users/user NFSHomeDirectory dir" }
end

describe get_command(:update_user_login_shell, 'user', '/bin/bash') do
  it { should eq "dscl . -create /Users/user UserShell /bin/bash" }
end

describe get_command(:update_user_encrypted_password, 'user', 'pass') do
  it { should eq "dscl . passwd /Users/user pass" }
end

describe get_command(:update_user_gid, 'user', '100') do
  it { should eq "dscl . -create /Users/user PrimaryGroupID 100" }
end

describe get_command(:add_user, 'foo', :home_directory => '/Users/foo', :password => '$6$foo/bar', :shell => '/bin/zsh', :create_home => true) do
  it { should eq 'dscl . -create /Users/foo && dscl . -create /Users/foo UserShell /bin/zsh && dscl . -create /Users/foo NFSHomeDirectory /Users/foo && dscl . passwd /Users/foo \$6\$foo/bar && createhomedir -b -u foo' }
end