-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewline_spec.rb
67 lines (60 loc) · 1.53 KB
/
newline_spec.rb
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
require 'spec_helper_acceptance'
describe 'concat ensure_newline parameter' do
basedir = default.tmpdir('concat')
context 'when false' do
before(:all) do
pp = <<-MANIFEST
file { '#{basedir}':
ensure => directory
}
MANIFEST
apply_manifest(pp)
end
pp = <<-MANIFEST
concat { '#{basedir}/file':
ensure_newline => false,
}
concat::fragment { '1':
target => '#{basedir}/file',
content => '1',
}
concat::fragment { '2':
target => '#{basedir}/file',
content => '2',
}
MANIFEST
it 'applies the manifest twice with no stderr' do
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end
describe file("#{basedir}/file") do
it { is_expected.to be_file }
its(:content) { is_expected.to match '12' }
end
end
context 'when true' do
pp = <<-MANIFEST
concat { '#{basedir}/file':
ensure_newline => true,
}
concat::fragment { '1':
target => '#{basedir}/file',
content => '1',
}
concat::fragment { '2':
target => '#{basedir}/file',
content => '2',
}
MANIFEST
it 'applies the manifest twice with no stderr' do
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end
describe file("#{basedir}/file") do
it { is_expected.to be_file }
its(:content) do
is_expected.to match %r{1\n2\n}
end
end
end
end