class JsonResponseMatchers::Base
Attributes
actual[R]
expected[R]
Public Class Methods
new(expected)
click to toggle source
# File lib/json_response_matchers/base.rb, line 11 def initialize expected @expected = expected end
Public Instance Methods
at_key(*hash_keys)
click to toggle source
# File lib/json_response_matchers/base.rb, line 15 def at_key *hash_keys @keys = hash_keys self end
diffable?()
click to toggle source
# File lib/json_response_matchers/base.rb, line 20 def diffable? true end
Private Instance Methods
extract_parsed_json_from(json_or_response)
click to toggle source
# File lib/json_response_matchers/base.rb, line 27 def extract_parsed_json_from json_or_response json = json_or_response.respond_to?(:body) ? json_or_response.body : json_or_response JSON.parse json end
fetch_from(hash)
click to toggle source
# File lib/json_response_matchers/base.rb, line 32 def fetch_from hash ( @keys || [] ).each { |key| hash = hash.fetch(Integer === key ? key : key.to_s) } hash end