Sha256: 7008b9028706200381734b02d76372be338c9bcdb23ab626779f009ff4f3ba43
Contents?: true
Size: 1.14 KB
Versions: 49
Compression:
Stored size: 1.14 KB
Contents
# frozen_string_literal: true require 'rails_helper' describe LHC do context 'configuration of placeholders' do it 'uses values for placeholders defined globally' do LHC.configure { |c| c.placeholder(:datastore, 'http://datastore/v2') } stub_request(:get, "http://datastore/v2/feedbacks") LHC.get('{+datastore}/feedbacks') end it 'uses explicit values first' do LHC.configure { |c| c.placeholder(:campaign_id, '123') } stub_request(:get, 'http://datastore/v2/campaign/456/feedbacks') url = 'http://datastore/v2/campaign/{campaign_id}/feedbacks' LHC.get(url, params: { campaign_id: '456' }) end it 'raises in case of claching placeholder name' do LHC.configure { |c| c.placeholder(:datastore, 'http://datastore') } expect(lambda { LHC.config.placeholder(:datastore, 'http://datastore') }).to raise_error 'Placeholder already exists for that name' end it 'enforces placeholder name to be a symbol' do LHC.configure { |c| c.placeholder('datatore', 'http://datastore') } expect(LHC.config.placeholders[:datatore]).to eq 'http://datastore' end end end
Version data entries
49 entries across 49 versions & 1 rubygems