Module: Pact::Matchers

Extended by:
Matchers
Included in:
FormDiffer, JsonDiffer, Matchers, QueryString, TextDiffer
Defined in:
lib/pact/matchers/matchers.rb,
lib/pact/matchers/differ.rb,
lib/pact/matchers/difference.rb,
lib/pact/matchers/base_difference.rb,
lib/pact/matchers/type_difference.rb,
lib/pact/matchers/no_diff_at_index.rb,
lib/pact/matchers/regexp_difference.rb,
lib/pact/matchers/list_diff_formatter.rb,
lib/pact/matchers/unix_diff_formatter.rb,
lib/pact/matchers/extract_diff_messages.rb,
lib/pact/matchers/embedded_diff_formatter.rb

Overview

Should be called Differs Note to self: Some people are using this module directly, so if you refactor it maintain backwards compatibility

Defined Under Namespace

Classes: BaseDifference, Differ, Difference, EmbeddedDiffFormatter, ExtractDiffMessages, ListDiffFormatter, NoDiffAtIndex, RegexpDifference, TypeDifference, UnixDiffFormatter

Constant Summary collapse

NO_DIFF_AT_INDEX =
NoDiffAtIndex.new
DEFAULT_OPTIONS =
{allow_unexpected_keys: true, type: false}.freeze
NO_DIFF =
{}.freeze

Instance Method Summary collapse

Instance Method Details

#diff(expected, actual, opts = {}) ⇒ Object



30
31
32
# File 'lib/pact/matchers/matchers.rb', line 30

def diff expected, actual, opts = {}
  calculate_diff(expected, actual, DEFAULT_OPTIONS.merge(opts))
end

#type_diff(expected, actual, opts = {}) ⇒ Object Also known as: structure_diff



34
35
36
# File 'lib/pact/matchers/matchers.rb', line 34

def type_diff expected, actual, opts = {}
  calculate_diff expected, actual, DEFAULT_OPTIONS.merge(opts).merge(type: true)
end