Class: Joust::ExpectedResponse
- Inherits:
-
Object
- Object
- Joust::ExpectedResponse
- Defined in:
- lib/joust/expected_response.rb
Instance Method Summary collapse
Instance Method Details
#match?(json_hash) ⇒ Boolean
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/joust/expected_response.rb', line 4 def match?(json_hash) ['result', 'error', 'id'].each { |key| @expected[key] = :missing if !@expected.has_key?(key) } if json_hash.empty? return false unless @expected.values == [:missing, :missing, :missing] return true end @expected.each do |key, val| next if val == :missing && !json_hash.has_key?(key) return false unless json_hash[key] == val end true rescue Exception false end |