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, error_key, prefix) ⇒ ExpectedValue

Returns a new instance of ExpectedValue.



7
8
9
# File 'lib/json_rspec_match_maker/expected_value.rb', line 7

def initialize(match_function, expected_instance, error_key, prefix)
  @value = fetch_expected_value(expected_instance, match_function, error_key, prefix)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object

Raises:

  • (ArgumentError)


11
12
13
14
# File 'lib/json_rspec_match_maker/expected_value.rb', line 11

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