Module: Pact::Matchers

Extended by:
Matchers
Included in:
Matchers
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,
lib/pact/matchers/multipart_form_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, MultipartFormDiffFormatter, NoDiffAtIndex, RegexpDifference, TypeDifference, UnixDiffFormatter

Constant Summary collapse

NO_DIFF_AT_INDEX =
NoDiffAtIndex.new
NO_DIFF =
{}.freeze
NUMERIC_TYPES =
%w[Integer Float Fixnum Bignum BigDecimal].freeze
DEFAULT_OPTIONS =
{
  allow_unexpected_keys: true,
  type: false
}.freeze

Instance Method Summary collapse

Instance Method Details

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



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

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

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



38
39
40
# File 'lib/pact/matchers/matchers.rb', line 38

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