From d80e0fffabf8db5c65ae82e3cf4eeb08ea63e4ab Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Mon, 19 Mar 2018 12:14:42 +1100 Subject: [PATCH] fix: dynamically load pact/matchers This fixes the require issues caused by 3d2a48829dcd81fbb66e0d2b2562dc7abe9be94f --- lib/pact/shared/form_differ.rb | 6 ++---- lib/pact/shared/json_differ.rb | 7 ++----- lib/pact/shared/text_differ.rb | 6 ++---- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/lib/pact/shared/form_differ.rb b/lib/pact/shared/form_differ.rb index 1850494..113a80d 100644 --- a/lib/pact/shared/form_differ.rb +++ b/lib/pact/shared/form_differ.rb @@ -3,10 +3,9 @@ module Pact class FormDiffer - extend Matchers - def self.call expected, actual, options = {} - diff to_hash(expected), to_hash(actual), options + require 'pact/matchers' # avoid recursive loop between this file and pact/matchers + ::Pact::Matchers.diff to_hash(expected), to_hash(actual), options end def self.to_hash form_body @@ -29,6 +28,5 @@ def self.decode_www_form string hash[key] << value end end - end end diff --git a/lib/pact/shared/json_differ.rb b/lib/pact/shared/json_differ.rb index 8f97c7f..e15834e 100644 --- a/lib/pact/shared/json_differ.rb +++ b/lib/pact/shared/json_differ.rb @@ -1,13 +1,10 @@ module Pact class JsonDiffer - extend Matchers - # Delegates to https://github.com/pact-foundation/pact-support/blob/master/lib/pact/matchers/matchers.rb#L25 def self.call expected, actual, options = {} - diff expected, actual, options + require 'pact/matchers' # avoid recursive loop between this file and pact/matchers + ::Pact::Matchers.diff expected, actual, options end - - end end diff --git a/lib/pact/shared/text_differ.rb b/lib/pact/shared/text_differ.rb index 8084955..5ff59e6 100644 --- a/lib/pact/shared/text_differ.rb +++ b/lib/pact/shared/text_differ.rb @@ -1,12 +1,10 @@ -require 'pact/matchers/difference' module Pact class TextDiffer - extend Matchers - def self.call expected, actual, options = {} - diff expected, actual, options + require 'pact/matchers' # avoid recursive loop between this file and pact/matchers + ::Pact::Matchers.diff expected, actual, options end end