Sha256: bc1084d8b354eccbdef90b06bd03b4317fc28cf3230b78a80a53de6d539e858c

Contents?: true

Size: 796 Bytes

Versions: 1

Compression:

Stored size: 796 Bytes

Contents

require "spec_helper"

describe G5Updatable::Fetcher do
  let(:token) { 'a-token' }
  let(:app_name) { 'https://g5-cms-foo' }
  let(:url) { "https://g5-hub.herokuapp.com/clients/g5-c-1234abcd-client-urn.json" }

  describe ".urn_for_env" do
    subject(:url_for_env) { described_class.url_for_env(url) }

    context 'HUB_URL set' do
      let!(:old_env) { ENV['HUB_URL'] }

      before { ENV['HUB_URL'] = 'https://test-hub.getg5.com' }
      after { ENV['HUB_URL'] = old_env }

      it 'substitutes the domain for the env value' do
        expect(url_for_env).to eq('https://test-hub.getg5.com/clients/g5-c-1234abcd-client-urn.json')
      end
    end

    context 'HUB_URL not set' do
      it 'returns the passed in url' do
        expect(url_for_env).to eq(url)
      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/fetcher_spec.rb