Sha256: a9e9951978beef87a24ad181390f6534518f182a01ed1c866054592a262af869
Contents?: true
Size: 1.05 KB
Versions: 12
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true require 'rails_helper' describe DHS::Record do context 'provider' do before do module Provider class BaseRecord < DHS::Record provider params: { api_key: 123 } end class Record < Provider::BaseRecord endpoint 'http://provider/records' end end class AnotherRecord < DHS::Record endpoint 'http://other_provider/records' end stub_request(:get, 'http://provider/records?id=1&api_key=123') .to_return(body: { name: 'Steve' }.to_json) stub_request(:get, 'http://other_provider/records?id=1') .to_return(body: { name: 'Not Steve' }.to_json) end it 'applies provider options when making requests to that provider' do record = Provider::Record.find(1) expect(record.name).to eq 'Steve' end it 'does not apply provider options when making requests to other records' do Provider::Record.find(1) record = AnotherRecord.find(1) expect(record.name).to eq 'Not Steve' end end end
Version data entries
12 entries across 12 versions & 1 rubygems