Skip to content

Commit d80e0ff

Browse files
committed
fix: dynamically load pact/matchers
This fixes the require issues caused by 3d2a488
1 parent 5732f8f commit d80e0ff

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

lib/pact/shared/form_differ.rb

+2-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
module Pact
44
class FormDiffer
55

6-
extend Matchers
7-
86
def self.call expected, actual, options = {}
9-
diff to_hash(expected), to_hash(actual), options
7+
require 'pact/matchers' # avoid recursive loop between this file and pact/matchers
8+
::Pact::Matchers.diff to_hash(expected), to_hash(actual), options
109
end
1110

1211
def self.to_hash form_body
@@ -29,6 +28,5 @@ def self.decode_www_form string
2928
hash[key] << value
3029
end
3130
end
32-
3331
end
3432
end

lib/pact/shared/json_differ.rb

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
module Pact
22
class JsonDiffer
33

4-
extend Matchers
5-
64
# Delegates to https://github.com/pact-foundation/pact-support/blob/master/lib/pact/matchers/matchers.rb#L25
75
def self.call expected, actual, options = {}
8-
diff expected, actual, options
6+
require 'pact/matchers' # avoid recursive loop between this file and pact/matchers
7+
::Pact::Matchers.diff expected, actual, options
98
end
10-
11-
129
end
1310
end

lib/pact/shared/text_differ.rb

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
require 'pact/matchers/difference'
21

32
module Pact
43
class TextDiffer
54

6-
extend Matchers
7-
85
def self.call expected, actual, options = {}
9-
diff expected, actual, options
6+
require 'pact/matchers' # avoid recursive loop between this file and pact/matchers
7+
::Pact::Matchers.diff expected, actual, options
108
end
119

1210
end

0 commit comments

Comments
 (0)