Commit a30d28b3 authored by Fabio Pelosin's avatar Fabio Pelosin

[Integration] Don't copare diff files if they are equal

parent c7b67015
...@@ -191,27 +191,30 @@ def yaml_should_match(expected, produced) ...@@ -191,27 +191,30 @@ def yaml_should_match(expected, produced)
# Remove CocoaPods version # Remove CocoaPods version
expected_yaml.delete('COCOAPODS') expected_yaml.delete('COCOAPODS')
produced_yaml.delete('COCOAPODS') produced_yaml.delete('COCOAPODS')
desc = [] desc = []
desc << "YAML comparison error `#{expected}`" unless expected_yaml == produced_yaml
desc << "YAML comparison error `#{expected}`"
desc << ("--- YAML DIFF " << "-" * 65)
diffy_diff = '' desc << ("--- YAML DIFF " << "-" * 65)
Diffy::Diff.new(expected.to_s, produced.to_s, :source => 'files', :context => 3).each do |line| diffy_diff = ''
case line Diffy::Diff.new(expected.to_s, produced.to_s, :source => 'files', :context => 3).each do |line|
when /^\+/ then diffy_diff << line.green case line
when /^-/ then diffy_diff << line.red when /^\+/ then diffy_diff << line.green
else diffy_diff << line when /^-/ then diffy_diff << line.red
else diffy_diff << line
end
end end
desc << diffy_diff
desc << ("--- XCODEPROJ DIFF " << "-" * 60)
diff_options = {:key_1 => "$produced", :key_2 => "$expected"}
diff = Xcodeproj::Differ.diff(produced_yaml, expected_yaml, diff_options).to_yaml
diff.gsub!("$produced", "produced".green)
diff.gsub!("$expected", "expected".red)
desc << diff
desc << ("--- END " << "-" * 70)
end end
desc << diffy_diff
desc << ("--- XCODEPROJ DIFF " << "-" * 60)
diff_options = {:key_1 => "$produced", :key_2 => "$expected"}
diff = Xcodeproj::Differ.diff(produced_yaml, expected_yaml, diff_options).to_yaml
diff.gsub!("$produced", "produced".green)
diff.gsub!("$expected", "expected".red)
desc << diff
desc << ("--- END " << "-" * 70)
expected_yaml.should.satisfy(desc * "\n\n") do expected_yaml.should.satisfy(desc * "\n\n") do
if RUBY_VERSION < "1.9" if RUBY_VERSION < "1.9"
...@@ -255,18 +258,20 @@ end ...@@ -255,18 +258,20 @@ end
def file_should_match(expected, produced) def file_should_match(expected, produced)
is_equal = FileUtils.compare_file(expected, produced) is_equal = FileUtils.compare_file(expected, produced)
description = [] description = []
description << "File comparison error `#{expected}`" unless is_equal
description << "" description << "File comparison error `#{expected}`"
description << ("--- DIFF " << "-" * 70) description << ""
Diffy::Diff.new(expected.to_s, produced.to_s, :source => 'files', :context => 3).each do |line| description << ("--- DIFF " << "-" * 70)
case line Diffy::Diff.new(expected.to_s, produced.to_s, :source => 'files', :context => 3).each do |line|
when /^\+/ then description << line.gsub("\n",'').green case line
when /^-/ then description << line.gsub("\n",'').red when /^\+/ then description << line.gsub("\n",'').green
else description << line.gsub("\n",'') when /^-/ then description << line.gsub("\n",'').red
else description << line.gsub("\n",'')
end
end end
description << ("--- END " << "-" * 70)
description << ""
end end
description << ("--- END " << "-" * 70)
description << ""
is_equal.should.satisfy(description * "\n") do is_equal.should.satisfy(description * "\n") do
is_equal == true is_equal == true
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment