Sha256: 65d6fa13cd2571d515de61d13dba8cdc2786427a4220f6be9dcf35023f27eee9
Contents?: true
Size: 1.02 KB
Versions: 19
Compression:
Stored size: 1.02 KB
Contents
require 'rails_helper' describe LHS::Record do let(:datastore) { 'http://local.ch/v2' } before do LHC.config.placeholder(:datastore, datastore) class Record < LHS::Record endpoint '{+datastore}/content-ads/{campaign_id}/feedbacks' endpoint '{+datastore}/feedbacks' end end context 'first' do it 'finds a single record' do stub_request(:get, "#{datastore}/feedbacks?limit=1") .to_return(status: 200, body: load_json(:feedback)) record = Record.first expect(record).to be_kind_of Record expect(record.source_id).to be_present end it 'returns nil if no record was found' do stub_request(:get, "#{datastore}/feedbacks?limit=1") .to_return(status: 404) expect(Record.first).to be_nil end end context 'first!' do it 'raises if nothing was found with parameters' do stub_request(:get, "#{datastore}/feedbacks?limit=1") .to_return(status: 404) expect { Record.first! }.to raise_error LHC::NotFound end end end
Version data entries
19 entries across 19 versions & 1 rubygems