blob: 9cb199b5f5d30e6bc0d80836338324a3de01da0a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
|