Class: EqualJson

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expected) ⇒ EqualJson

Returns a new instance of EqualJson.



11
12
13
14
15
16
# File 'lib/eq_json.rb', line 11

def initialize(expected)
  @expected = expected
  @jsonPathRoot = "$."
  @jsonPath = @jsonPathRoot
  @messageGenerator = EqJsonMessageGenerator.new(self)
end

Instance Attribute Details

#actualObject

Returns the value of attribute actual.



8
9
10
# File 'lib/eq_json.rb', line 8

def actual
  @actual
end

#currentActualObjObject

Returns the value of attribute currentActualObj.



8
9
10
# File 'lib/eq_json.rb', line 8

def currentActualObj
  @currentActualObj
end

#currentExpectedObjObject

Returns the value of attribute currentExpectedObj.



8
9
10
# File 'lib/eq_json.rb', line 8

def currentExpectedObj
  @currentExpectedObj
end

#currentJsonKeyObject

Returns the value of attribute currentJsonKey.



8
9
10
# File 'lib/eq_json.rb', line 8

def currentJsonKey
  @currentJsonKey
end

#expectedObject

Returns the value of attribute expected.



8
9
10
# File 'lib/eq_json.rb', line 8

def expected
  @expected
end

#jsonPathObject

Returns the value of attribute jsonPath.



8
9
10
# File 'lib/eq_json.rb', line 8

def jsonPath
  @jsonPath
end

#jsonPathRootObject

Returns the value of attribute jsonPathRoot.



8
9
10
# File 'lib/eq_json.rb', line 8

def jsonPathRoot
  @jsonPathRoot
end

Instance Method Details

#descriptionObject



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

def description
  "Excpect {@expected}"
end

#failure_messageObject



24
25
26
27
28
29
30
31
32
# File 'lib/eq_json.rb', line 24

def failure_message
  if RSpec.configuration.methods.include? :json_debug_config
    if RSpec.configuration.json_debug_config?
      debugDumper = EqJsonDebugDumper.new(self)
      debugDumper.dump()
    end
  end
  return @failureMessage
end

#failure_message_when_negatedObject



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

def failure_message_when_negated
  "Expeced failure_message_when_nagated"
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
21
22
# File 'lib/eq_json.rb', line 18

def matches?(actual)
  @actual = actual

  matchesObject?(@expected, @actual)
end