Class: JsonRspecMatchMaker::ExpectedValue

Inherits:
Object
  • Object
show all
Defined in:
lib/json_rspec_match_maker/expected_value.rb

Overview

Handles fetching the expected value from the expected instance

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(match_function, expected_instance) ⇒ ExpectedValue

Returns a new instance of ExpectedValue.



5
6
7
# File 'lib/json_rspec_match_maker/expected_value.rb', line 5

def initialize(match_function, expected_instance)
  @value = match_function.call(expected_instance)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



4
5
6
# File 'lib/json_rspec_match_maker/expected_value.rb', line 4

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object

Raises:

  • (ArgumentError)


9
10
11
12
# File 'lib/json_rspec_match_maker/expected_value.rb', line 9

def ==(other)
  raise ArgumentError unless other.is_a? TargetValue
  other.value == value
end