Sha256: 32f45605133eb72856a80241263bdf5002ee4657d58d745e3b60b865d0638415
Contents?: true
Size: 1013 Bytes
Versions: 40
Compression:
Stored size: 1013 Bytes
Contents
# # render(tag) might compare two very large strings, with lots of whitespace # differences which would be hard to diagnose. So use the Comparison module to # zero in on the bug. # module Spec::Rails::Matchers class RenderTags # Guard against double definitions unless method_defined?(:_old_matches?) alias_method :_old_matches?, :matches? alias_method :_old_failure_message, :failure_message # If comparison was just a straight '==' then redo the comparison # using the comparison class, and save an error message def matches?(page) result = _old_matches? page return result if result || !@expected || !@actual comparison = Comparison.new(@expected, @actual) @error_message = comparison.message comparison.same? end # Return the error message from Comparison if it was saved def failure_message return @error_message unless @error_message.nil? _old_failure_message end end end end
Version data entries
40 entries across 40 versions & 1 rubygems