spec/flipper/cloud_spec.rb in flipper-cloud-0.21.0.rc1 vs spec/flipper/cloud_spec.rb in flipper-cloud-0.21.0.rc2
- old
+ new
@@ -10,11 +10,11 @@
context "initialize with token" do
let(:token) { 'asdf' }
before do
- @instance = described_class.new(token)
+ @instance = described_class.new(token: token)
memoized_adapter = @instance.adapter
sync_adapter = memoized_adapter.adapter
@http_adapter = sync_adapter.instance_variable_get('@remote')
@http_client = @http_adapter.instance_variable_get('@client')
end
@@ -50,11 +50,11 @@
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')
+ @instance = described_class.new(token: 'asdf', url: 'https://www.fakeflipper.com/sadpanda')
memoized_adapter = @instance.adapter
sync_adapter = memoized_adapter.adapter
@http_adapter = sync_adapter.instance_variable_get('@remote')
@http_client = @http_adapter.instance_variable_get('@client')
end
@@ -73,16 +73,16 @@
end
end
it 'can set instrumenter' do
instrumenter = Flipper::Instrumenters::Memory.new
- instance = described_class.new('asdf', instrumenter: instrumenter)
+ instance = described_class.new(token: 'asdf', instrumenter: instrumenter)
expect(instance.instrumenter).to be(instrumenter)
end
it 'allows wrapping adapter with another adapter like the instrumenter' do
- instance = described_class.new('asdf') do |config|
+ instance = described_class.new(token: 'asdf') do |config|
config.adapter do |adapter|
Flipper::Adapters::Instrumented.new(adapter)
end
end
# instance.adapter is memoizable adapter instance
@@ -90,30 +90,30 @@
end
it 'can set debug_output' do
expect(Flipper::Adapters::Http::Client).to receive(:new)
.with(hash_including(debug_output: STDOUT))
- described_class.new('asdf', debug_output: STDOUT)
+ described_class.new(token: 'asdf', debug_output: STDOUT)
end
it 'can set read_timeout' do
expect(Flipper::Adapters::Http::Client).to receive(:new)
.with(hash_including(read_timeout: 1))
- described_class.new('asdf', read_timeout: 1)
+ described_class.new(token: 'asdf', read_timeout: 1)
end
it 'can set open_timeout' do
expect(Flipper::Adapters::Http::Client).to receive(:new)
.with(hash_including(open_timeout: 1))
- described_class.new('asdf', open_timeout: 1)
+ described_class.new(token: 'asdf', open_timeout: 1)
end
if RUBY_VERSION >= '2.6.0'
it 'can set write_timeout' do
expect(Flipper::Adapters::Http::Client).to receive(:new)
.with(hash_including(open_timeout: 1))
- described_class.new('asdf', open_timeout: 1)
+ described_class.new(token: 'asdf', open_timeout: 1)
end
end
it 'can import' do
stub_request(:post, /www\.flippercloud\.io\/adapter\/features.*/).
@@ -127,11 +127,11 @@
flipper.enable(:test)
flipper.enable(:search)
flipper.enable_actor(:stats, Flipper::Actor.new("jnunemaker"))
flipper.enable_percentage_of_time(:logging, 5)
- cloud_flipper = Flipper::Cloud.new("asdf")
+ cloud_flipper = Flipper::Cloud.new(token: "asdf")
get_all = {
"logging" => {actors: Set.new, boolean: nil, groups: Set.new, percentage_of_actors: nil, percentage_of_time: "5"},
"search" => {actors: Set.new, boolean: "true", groups: Set.new, percentage_of_actors: nil, percentage_of_time: nil},
"stats" => {actors: Set["jnunemaker"], boolean: nil, groups: Set.new, percentage_of_actors: nil, percentage_of_time: nil},
@@ -156,11 +156,11 @@
flipper.enable(:test)
flipper.enable(:search)
flipper.enable_actor(:stats, Flipper::Actor.new("jnunemaker"))
flipper.enable_percentage_of_time(:logging, 5)
- cloud_flipper = Flipper::Cloud.new("asdf")
+ cloud_flipper = Flipper::Cloud.new(token: "asdf")
get_all = {
"logging" => {actors: Set.new, boolean: nil, groups: Set.new, percentage_of_actors: nil, percentage_of_time: "5"},
"search" => {actors: Set.new, boolean: "true", groups: Set.new, percentage_of_actors: nil, percentage_of_time: nil},
"stats" => {actors: Set["jnunemaker"], boolean: nil, groups: Set.new, percentage_of_actors: nil, percentage_of_time: nil},
@@ -184,10 +184,10 @@
flipper.enable(:test)
flipper.enable(:search)
flipper.enable_actor(:stats, Flipper::Actor.new("jnunemaker"))
flipper.enable_percentage_of_time(:logging, 5)
- cloud_flipper = Flipper::Cloud.new("asdf")
+ cloud_flipper = Flipper::Cloud.new(token: "asdf")
get_all = {
"logging" => {actors: Set.new, boolean: nil, groups: Set.new, percentage_of_actors: nil, percentage_of_time: "5"},
"search" => {actors: Set.new, boolean: "true", groups: Set.new, percentage_of_actors: nil, percentage_of_time: nil},
"stats" => {actors: Set["jnunemaker"], boolean: nil, groups: Set.new, percentage_of_actors: nil, percentage_of_time: nil},