Class: Synthesis::ExpectationMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/synthesis/expectation_matcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(expectation_one, expectation_two) ⇒ ExpectationMatcher

Returns a new instance of ExpectationMatcher.



3
4
5
# File 'lib/synthesis/expectation_matcher.rb', line 3

def initialize(expectation_one, expectation_two)
  @expectation_one, @expectation_two = expectation_one, expectation_two
end

Instance Method Details

#match?Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
13
14
# File 'lib/synthesis/expectation_matcher.rb', line 7

def match?
  return false unless @expectation_one.class == @expectation_two.class
  return false unless @expectation_one.receiver_class == @expectation_two.receiver_class
  return false unless @expectation_one.method == @expectation_two.method
  return false unless @expectation_one.arg_types == @expectation_two.arg_types
  return false unless return_values_match?
  true
end