Sha256: 6dd8b54d33af8bf1074450ff0720a44b16bb6eb3ffa7615278e83f064896da8e
Contents?: true
Size: 1.2 KB
Versions: 7
Compression:
Stored size: 1.2 KB
Contents
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.lb-service/v2') } stub_request(:get, "http://datastore.lb-service/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-stg.lb-service/v2/campaign/456/feedbacks') url = 'http://datastore-stg.lb-service/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.lb-service') } expect(->{ LHC.config.placeholder(:datastore, 'http://datastore-stg.lb-service') }).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.lb-service') } expect(LHC.config.placeholders[:datatore]).to eq 'http://datastore.lb-service' end end end
Version data entries
7 entries across 7 versions & 1 rubygems