Sha256: f72e5033a2792f821fea271b0caaca2c7a5bc2a39b2577485f917daa2ecf74d3
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
require 'spec_helper' describe G5Updatable::AllClientUrnsFetcher do let(:token) { 'a-token' } describe '#fetch_uids' do before do allow(G5Updatable::Fetcher).to receive(:do_with_username_pw_access_token).and_yield(token) stub_request(:get, "https://g5-hub.herokuapp.com/urns.json?access_token=a-token&updatable_version=#{G5Updatable::VERSION}"). with(:headers => {'Accept' => 'application/json', 'Content-Type' => 'application/json'}). to_return(status: status, body: fixture('urns.json'), headers: {}) end subject { described_class.fetch_uids } context 'success' do let(:status) { 200 } it do is_expected.to eq(['https://g5-hub.herokuapp.com/clients/g5-c-iwcqdt3u-arenhall-management-company-client.json', 'https://g5-hub.herokuapp.com/clients/g5-c-iw2fm3cx-artis-senior-living-management-multidomain.json']) end end context '404' do let(:status) { 404 } it 'quietly fails' do expect { subject }.to_not raise_error end end context '500' do let(:status) { 500 } it 'raises error' do expect { subject }.to raise_error("I got an unexpected response code '500'") end end end describe '#hub_url' do it 'returns the default hub url' do expect(described_class.hub_url).to eq(G5Updatable::HUB_URL) end context 'with HUB_URL override' do before { stub_const('G5Updatable::HUB_URL', 'http://whatever.com') } it 'returns a custom URL if set' do expect(described_class.hub_url).to eq('http://whatever.com') end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
g5_updatable-1.0.2.pre.1 | spec/lib/g5_updatable/all_client_urns_fetcher_spec.rb |