diff options
| author | Daniel Pittman <daniel@rimspace.net> | 2011-03-03 00:05:38 -0800 |
|---|---|---|
| committer | Daniel Pittman <daniel@rimspace.net> | 2011-03-03 16:29:43 -0800 |
| commit | 53b6df3781fe67a3e7fd686cb93cad50c40c6ce3 (patch) | |
| tree | 8e6a51b5133612d77ab8e1add963e422410d858b /spec/shared_behaviours | |
| parent | 0f6faf5e138e6d11e79b2430b4e6fa6139442509 (diff) | |
| download | puppet-53b6df3781fe67a3e7fd686cb93cad50c40c6ce3.tar.gz puppet-53b6df3781fe67a3e7fd686cb93cad50c40c6ce3.tar.xz puppet-53b6df3781fe67a3e7fd686cb93cad50c40c6ce3.zip | |
(#6582) eliminate fakeparsefile helper method.
This was a helper that implemented rspec style "shared behaviour" for
Test::Unit; now that we have moved on we can use the upstream implementation
instead. This eliminates a whole bit of code we have to maintain.
Reviewed-By: Nick Lewis <nick@puppetlabs.com>
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 000000000..9cb199b5f --- /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? then + 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!(/^# HEADER.+\n/, '') + + oldlines = File.readlines(file) + newlines = text.chomp.split "\n" + oldlines.zip(newlines).each do |old, new| + new.gsub(/\s+/, '').should == old.chomp.gsub(/\s+/, '') + end + end + end +end |
