forked from theforeman/puppet-certs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspec_helper.rb
30 lines (23 loc) · 1.14 KB
/
spec_helper.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
# This file is managed centrally by modulesync
# https://github.com/theforeman/foreman-installer-modulesync
require 'voxpupuli/test/spec_helper'
add_mocked_facts!
def get_content(subject, title)
is_expected.to contain_file(title)
content = subject.resource('file', title).send(:parameters)[:content]
content.split(/\n/).reject { |line| line =~ /(^#|^$|^\s+#)/ }
end
def verify_exact_contents(subject, title, expected_lines)
expect(get_content(subject, title)).to match_array(expected_lines)
end
def verify_concat_fragment_contents(subject, title, expected_lines)
is_expected.to contain_concat__fragment(title)
content = subject.resource('concat::fragment', title).send(:parameters)[:content]
expect(content.split("\n") & expected_lines).to match_array(expected_lines)
end
def verify_concat_fragment_exact_contents(subject, title, expected_lines)
is_expected.to contain_concat__fragment(title)
content = subject.resource('concat::fragment', title).send(:parameters)[:content]
expect(content.split(/\n/).reject { |line| line =~ /(^#|^$|^\s+#)/ }).to match_array(expected_lines)
end
Dir["./spec/support/**/*.rb"].sort.each { |f| require f }