module JSONAPI::RSpec

Public Class Methods

as_indifferent_hash(doc) click to toggle source
# File lib/jsonapi/rspec.rb, line 27
def self.as_indifferent_hash(doc)
  return doc unless ::RSpec.configuration.jsonapi_indifferent_hash

  if doc.respond_to?(:with_indifferent_access)
    return doc.with_indifferent_access
  end

  JSON.parse(JSON.generate(doc))
end