Class: Pact::MultipartFormDiffer

Inherits:
Object
  • Object
show all
Defined in:
lib/pact/shared/multipart_form_differ.rb

Class Method Summary collapse

Class Method Details

.call(expected, actual, options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/pact/shared/multipart_form_differ.rb', line 6

def self.call expected, actual, options = {}
  require 'pact/matchers' # avoid recursive loop between this file and pact/matchers
  expected_boundary = expected.split.first
  actual_boundary = actual.split.first
  actual_with_hardcoded_boundary = actual.gsub(actual_boundary, expected_boundary)
  TextDiffer.call(expected, actual_with_hardcoded_boundary, options)
rescue StandardError
  TextDiffer.call(expected, actual, options)
end