-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdefault_spec.rb
More file actions
37 lines (31 loc) · 1.06 KB
/
default_spec.rb
File metadata and controls
37 lines (31 loc) · 1.06 KB
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
36
37
require 'spec_helper'
describe 'sudo::default' do
context 'usual business' do
before { Fauxhai.mock :platform => 'ubuntu' }
let(:runner) { ChefSpec::ChefRunner.new.converge 'sudo::default' }
it 'installs the sudo package' do
runner.should install_package 'sudo'
end
it 'creates the /etc/sudoers file' do
runner.should create_file_with_content '/etc/sudoers', 'Defaults !lecture,tty_tickets,!fqdn'
end
end
context 'sudoers.d' do
let(:runner) do
ChefSpec::ChefRunner.new do |node|
node.set['authorization'] = {
'sudo' => {
'include_sudoers_d' => 'true'
}
}
end.converge 'sudo::default'
end
it 'creates the sudoers.d directory' do
runner.should create_directory '/etc/sudoers.d'
runner.directory('/etc/sudoers.d').should be_owned_by 'root', 'root'
end
it 'drops the README file' do
runner.should create_file_with_content '/etc/sudoers.d/README', 'As of Debian version 1.7.2p1-1, the default /etc/sudoers file created on'
end
end
end