Sha256: 3511c5e2804839ea69f290fd995141c8c6f29969aafa052dce96d4d7fcf4332d
Contents?: true
Size: 934 Bytes
Versions: 12
Compression:
Stored size: 934 Bytes
Contents
# frozen_string_literal: true require 'rails_helper' describe DHS::Record do context 'includes all (expanded)' do before do class Record < DHS::Record endpoint 'http://records/{id}' end stub_request(:get, 'http://records/1') .to_return( body: { car: { href: 'http://records/1/car' } }.to_json ) stub_request(:get, 'http://records/1/car?color=blue&limit=100') .to_return( body: { href: 'http://records/cars/1' }.to_json ) stub_request(:get, 'http://records/cars/1?color=blue&limit=100') .to_return( body: { name: 'wrum wrum' }.to_json ) end it 'expands linked resources and forwards proper reference' do record = Record.includes(:car).references(car: { params: { color: :blue } }).find(1) expect( record.car.name ).to eq 'wrum wrum' end end end
Version data entries
12 entries across 12 versions & 1 rubygems