module KnowsAboutApiResponses
Public Instance Methods
parse_response_data()
click to toggle source
Parses response data that is expected to be in JSON format.
@return [Hash] The response data.
# File lib/cucumber/blinkbox/responses.rb, line 7 def parse_response_data expect(HttpCapture::RESPONSES.last["Content-Type"]).to match(%r{^application/vnd.blinkboxbooks.data.v1\+json;?}) begin @response_data = JSON.load(HttpCapture::RESPONSES.last.body) rescue => e raise "The response is not valid JSON: #{e.message}" end end