Module RSCM::Difftool
In: lib/rscm/difftool.rb

Methods

Public Instance methods

assertion method that reports differences as diff. useful when comparing big strings

[Source]

    # File lib/rscm/difftool.rb, line 9
 9:     def assert_equal_with_diff(expected, actual, temp_basedir=File.dirname(__FILE__) + "/../../target")
10:       diff(expected, actual, temp_basedir) do |diff_io|
11:         diff_string = diff_io.read
12:         assert_equal("", diff_string, diff_string)
13:       end
14:     end

[Source]

    # File lib/rscm/difftool.rb, line 17
17:     def diff(expected, actual, temp_basedir, &block)
18:       dir = RSCM.new_temp_dir("diff", temp_basedir)
19:     
20:       expected_file = "#{dir}/expected"
21:       actual_file = "#{dir}/actual"
22:       File.open(expected_file, "w") {|io| io.write(expected)}
23:       File.open(actual_file, "w") {|io| io.write(actual)}
24: 
25:       difftool = WINDOWS ? File.dirname(__FILE__) + "/../../bin/diff.exe" : "diff"
26:       IO.popen("#{difftool} #{RSCM::PathConverter.filepath_to_nativepath(expected_file, false)} #{RSCM::PathConverter.filepath_to_nativepath(actual_file, false)}") do |io|
27:         yield io
28:       end
29:     end

[Validate]