spec/flipper/cloud_spec.rb in flipper-cloud-0.19.1 vs spec/flipper/cloud_spec.rb in flipper-cloud-0.20.0.beta1

- old
+ new

@@ -18,13 +18,17 @@ @http_adapter = sync_adapter.instance_variable_get('@remote') @http_client = @http_adapter.instance_variable_get('@client') end it 'returns Flipper::DSL instance' do - expect(@instance).to be_instance_of(Flipper::DSL) + expect(@instance).to be_instance_of(Flipper::Cloud::DSL) end + it 'can read the cloud configuration' do + expect(@instance.cloud_configuration).to be_instance_of(Flipper::Cloud::Configuration) + end + it 'configures instance to use http adapter' do expect(@http_adapter).to be_instance_of(Flipper::Adapters::Http) end it 'sets up correct url' do @@ -34,11 +38,11 @@ expect(uri.path).to eq('/adapter') end it 'sets correct token header' do headers = @http_client.instance_variable_get('@headers') - expect(headers['Feature-Flipper-Token']).to eq(token) + expect(headers['Flipper-Cloud-Token']).to eq(token) end it 'uses noop instrumenter' do expect(@instance.instrumenter).to be(Flipper::Instrumenters::Noop) end @@ -58,9 +62,15 @@ it 'sets correct url' do uri = @http_client.instance_variable_get('@uri') expect(uri.scheme).to eq('https') expect(uri.host).to eq('www.fakeflipper.com') expect(uri.path).to eq('/sadpanda') + end + end + + it 'can initialize with no token explicitly provided' do + with_modified_env "FLIPPER_CLOUD_TOKEN" => "asdf" do + expect(described_class.new).to be_instance_of(Flipper::Cloud::DSL) end end it 'can set instrumenter' do instrumenter = Flipper::Instrumenters::Memory.new