Sha256: c742bac5c7de202fc9f4faa8235e460d6d1c15ed4b0cb8e2a6a5c8ebe2fecdb5
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
require 'test/unit' require 'rscm/tempdir' require 'rscm/path_converter' require 'rscm/difftool' module RSCM module Difftool # assertion method that reports differences as diff. # useful when comparing big strings def assert_equal_with_diff(expected, actual, temp_basedir=File.dirname(__FILE__) + "/../../target") diff(expected, actual, temp_basedir) do |diff_io| diff_string = diff_io.read assert_equal("", diff_string, diff_string) end end module_function :assert_equal_with_diff def diff(expected, actual, temp_basedir, &block) dir = RSCM.new_temp_dir("diff", temp_basedir) expected_file = "#{dir}/expected" actual_file = "#{dir}/actual" File.open(expected_file, "w") {|io| io.write(expected)} File.open(actual_file, "w") {|io| io.write(actual)} difftool = WINDOWS ? File.dirname(__FILE__) + "/../../bin/diff.exe" : "diff" IO.popen("#{difftool} #{RSCM::PathConverter.filepath_to_nativepath(expected_file, false)} #{RSCM::PathConverter.filepath_to_nativepath(actual_file, false)}") do |io| yield io end end module_function :diff end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rscm-0.3.3 | lib/rscm/difftool.rb |