Sha256: b92c1c2857ae6be48b1def0c0b1e1f29dd434f698b0b62df264a6277823af9b4
Contents?: true
Size: 1.28 KB
Versions: 12
Compression:
Stored size: 1.28 KB
Contents
# frozen_string_literal: true require 'rails_helper' describe DHS::Record do context 'includes warning' do before do class Customer < DHS::Record endpoint 'http://datastore/customers/{id}' end end let!(:customer_request) do stub_request(:get, 'http://datastore/customers/1') .to_return( body: { contracts: { href: 'http://datastore/customers/1/contracts' } }.to_json ) end let!(:contracts_request) do stub_request(:get, 'http://datastore/customers/1/contracts') .to_return( body: { items: 10.times.map do { products: { href: 'http://datastore/products' } } end, limit: 10, offset: 0, total: 33 }.to_json ) end it 'warns if linked data was simply included but is paginated' do expect(lambda { Customer.includes_first_page(:contracts).find(1) }).to output( %r{\[WARNING\] You included `http://datastore/customers/1/contracts`, but this endpoint is paginated. You might want to use `includes_all` instead of `includes` \(https://github.com/DePayFi/dhs#includes_all-for-paginated-endpoints\)\.} ).to_stderr end end end
Version data entries
12 entries across 12 versions & 1 rubygems