diff options
author | Josh Cooper <josh@puppet.com> | 2018-07-13 09:38:02 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-13 09:38:02 -0700 |
commit | bd20d920a19e9b011dfd027a802985cea46ae04f (patch) | |
tree | f882cd2b7c31ae08cd242882b0f7f1d1ed89cbbd /spec/shared_behaviours | |
parent | 9d96ddecea6367abee1aa77859848b0c158fca80 (diff) | |
parent | c957642d70f4b778736a9b49cf1ef9702e42c4f1 (diff) | |
download | puppet-hosts_core-bd20d920a19e9b011dfd027a802985cea46ae04f.tar.gz puppet-hosts_core-bd20d920a19e9b011dfd027a802985cea46ae04f.tar.bz2 |
Merge pull request #1 from puppetlabs/extraction
Initial host module extraction
Diffstat (limited to 'spec/shared_behaviours')
-rw-r--r-- | spec/shared_behaviours/all_parsedfile_providers.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/shared_behaviours/all_parsedfile_providers.rb b/spec/shared_behaviours/all_parsedfile_providers.rb new file mode 100644 index 0000000..d697a14 --- /dev/null +++ b/spec/shared_behaviours/all_parsedfile_providers.rb @@ -0,0 +1,21 @@ +shared_examples_for 'all parsedfile providers' do |provider, *files| + if files.empty? + files = my_fixtures + end + + files.flatten.each do |file| + it "should rewrite #{file} reasonably unchanged" do + provider.stubs(:default_target).returns(file) + provider.prefetch + + text = provider.to_file(provider.target_records(file)) + text.gsub!(%r{^# HEADER.+\n}, '') + + oldlines = File.readlines(file) + newlines = text.chomp.split "\n" + oldlines.zip(newlines).each do |old, new| + expect(new.gsub(%r{\s+}, '')).to eq(old.chomp.gsub(%r{\s+}, '')) + end + end + end +end |