spec/flipper/adapters/http_spec.rb in flipper-0.26.2 vs spec/flipper/adapters/http_spec.rb in flipper-0.27.0

- old
+ new

@@ -50,10 +50,32 @@ expect(flipper[:search].groups_value).to eq(Set["some_made_up_group"]) expect(flipper[:search].disable_group(:some_made_up_group)).to be(true) expect(flipper[:search].groups_value).to eq(Set.new) end + + it "can import" do + adapter = Flipper::Adapters::Memory.new + source_flipper = Flipper.new(adapter) + source_flipper.enable_percentage_of_actors :search, 10 + source_flipper.enable_percentage_of_time :search, 15 + source_flipper.enable_actor :search, Flipper::Actor.new('User;1') + source_flipper.enable_actor :search, Flipper::Actor.new('User;100') + source_flipper.enable_group :search, :admins + source_flipper.enable_group :search, :employees + source_flipper.enable :plausible + source_flipper.disable :google_analytics + + flipper = Flipper.new(subject) + flipper.import(source_flipper) + expect(flipper[:search].percentage_of_actors_value).to be(10) + expect(flipper[:search].percentage_of_time_value).to be(15) + expect(flipper[:search].actors_value).to eq(Set["User;1", "User;100"]) + expect(flipper[:search].groups_value).to eq(Set["admins", "employees"]) + expect(flipper[:plausible].boolean_value).to be(true) + expect(flipper[:google_analytics].boolean_value).to be(false) + end end it "sends default headers" do headers = { 'Accept' => 'application/json', @@ -80,11 +102,11 @@ end end describe "#get_multi" do it "raises error when not successful response" do - stub_request(:get, "http://app.com/flipper/features?keys=feature_panel") + stub_request(:get, "http://app.com/flipper/features?keys=feature_panel&exclude_gate_names=true") .to_return(status: 503, body: "", headers: {}) adapter = described_class.new(url: 'http://app.com/flipper') expect { adapter.get_multi([flipper[:feature_panel]]) @@ -92,11 +114,11 @@ end end describe "#get_all" do it "raises error when not successful response" do - stub_request(:get, "http://app.com/flipper/features") + stub_request(:get, "http://app.com/flipper/features?exclude_gate_names=true") .to_return(status: 503, body: "", headers: {}) adapter = described_class.new(url: 'http://app.com/flipper') expect { adapter.get_all @@ -104,10 +126,10 @@ end end describe "#features" do it "raises error when not successful response" do - stub_request(:get, "http://app.com/flipper/features") + stub_request(:get, "http://app.com/flipper/features?exclude_gate_names=true") .to_return(status: 503, body: "", headers: {}) adapter = described_class.new(url: 'http://app.com/flipper') expect { adapter.features