Skip to content

Commit

Permalink
fix: dynamically load pact/matchers
Browse files Browse the repository at this point in the history
This fixes the require issues caused by 3d2a488
  • Loading branch information
bethesque committed Mar 19, 2018
1 parent 5732f8f commit d80e0ff
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
6 changes: 2 additions & 4 deletions lib/pact/shared/form_differ.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,6 +28,5 @@ def self.decode_www_form string
hash[key] << value
end
end

end
end
7 changes: 2 additions & 5 deletions lib/pact/shared/json_differ.rb
Original file line number Diff line number Diff line change
@@ -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
6 changes: 2 additions & 4 deletions lib/pact/shared/text_differ.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit d80e0ff

Please sign in to comment.