class Pact::RSpec::Matchers::MatchTerm

Public Class Methods

new(expected, differ, diff_formatter, example) click to toggle source
# File lib/pact/provider/rspec/matchers.rb, line 25
def initialize expected, differ, diff_formatter, example
  @expected = expected
  @differ = differ
  @diff_formatter = diff_formatter
  @example = example
end

Public Instance Methods

failure_message() click to toggle source
# File lib/pact/provider/rspec/matchers.rb, line 46
def failure_message
  match_term_failure_message @difference, @actual, @diff_formatter, Pact::RSpec.color_enabled?
end
matches?(actual) click to toggle source
# File lib/pact/provider/rspec/matchers.rb, line 32
def matches? actual
  @actual = actual
  @difference = @differ.call(@expected, @actual)
  unless @difference.empty?
    Pact::RSpec.with_rspec_3 do
      @example.metadata[:pact_diff] = @difference
    end
    Pact::RSpec.with_rspec_2 do
      @example.example.metadata[:pact_diff] = @difference
    end
  end
  @difference.empty?
end