Skip to content

Instantly share code, notes, and snippets.

@andriy-baran
Last active June 27, 2018 08:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andriy-baran/76df1355ddab1d46c2b7efa6b65ba86f to your computer and use it in GitHub Desktop.
Save andriy-baran/76df1355ddab1d46c2b7efa6b65ba86f to your computer and use it in GitHub Desktop.
module Helpers
def parse_json(json_data)
JSON.parse(json_data, symbolize_names: true)
end
def response_body
JSON.parse(response.body, symbolize_names: true)
end
def response_object
OpenStruct.new(parsed_body)
end
def response_objects
JSON.parse(response.body, object_class: OpenStruct)
end
end
RSpec.configure do |config|
config.include Helpers
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment