Class: Adapter::ActiveModel

Inherits:
Object
  • Object
show all
Includes:
RSpec::Matchers
Defined in:
lib/rspec/api_helpers/adapter/active_model/adapter.rb

Defined Under Namespace

Modules: CommonHelpers Classes: Collection, Resource

Class Method Summary collapse

Class Method Details

.collection(options, response, _binding) ⇒ Object



12
13
14
15
16
# File 'lib/rspec/api_helpers/adapter/active_model/adapter.rb', line 12

def collection(options, response, _binding)
  hashed_response = HashWithIndifferentAccess.new(JSON.parse(response.body))

  return Collection.new(options, hashed_response, _binding)
end

.resource(options, response, _binding) ⇒ Object



6
7
8
9
10
# File 'lib/rspec/api_helpers/adapter/active_model/adapter.rb', line 6

def resource(options, response, _binding)
  hashed_response = HashWithIndifferentAccess.new(JSON.parse(response.body))

  return Resource.new(options, hashed_response, _binding)
end