spec/flipper/cloud_spec.rb in flipper-cloud-0.12.2 vs spec/flipper/cloud_spec.rb in flipper-cloud-0.13.0.beta1

- old
+ new

@@ -1,17 +1,23 @@ require 'helper' require 'flipper/cloud' require 'flipper/adapters/instrumented' +require 'flipper/instrumenters/memory' RSpec.describe Flipper::Cloud do + before do + stub_request(:get, /featureflipper\.com/).to_return(status: 200, body: "{}") + end + context "initialize with token" do let(:token) { 'asdf' } before do @instance = described_class.new(token) memoized_adapter = @instance.adapter - @http_adapter = memoized_adapter.adapter + sync_adapter = memoized_adapter.adapter + @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) @@ -38,13 +44,16 @@ end end context 'initialize with token and options' do before do + stub_request(:get, /fakeflipper\.com/).to_return(status: 200, body: "{}") + @instance = described_class.new('asdf', url: 'https://www.fakeflipper.com/sadpanda') memoized_adapter = @instance.adapter - @http_adapter = memoized_adapter.adapter + sync_adapter = memoized_adapter.adapter + @http_adapter = sync_adapter.instance_variable_get('@remote') @http_client = @http_adapter.instance_variable_get('@client') end it 'sets correct url' do uri = @http_client.instance_variable_get('@uri') @@ -53,10 +62,10 @@ expect(uri.path).to eq('/sadpanda') end end it 'can set instrumenter' do - instrumenter = Object.new + instrumenter = Flipper::Instrumenters::Memory.new instance = described_class.new('asdf', instrumenter: instrumenter) expect(instance.instrumenter).to be(instrumenter) end it 'allows wrapping adapter with another adapter like the instrumenter' do