From 149346ef1bb413eb93d309ba4517a659ecc0515e Mon Sep 17 00:00:00 2001 From: John Nunemaker Date: Mon, 11 Dec 2023 11:17:35 -0500 Subject: [PATCH] Add spec to demonstrate failure of AR adapter when table missing See https://github.com/flippercloud/flipper/issues/557#issuecomment-1850350022 --- spec/flipper/adapters/active_record_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/flipper/adapters/active_record_spec.rb b/spec/flipper/adapters/active_record_spec.rb index 99054c1d9..de16dda37 100644 --- a/spec/flipper/adapters/active_record_spec.rb +++ b/spec/flipper/adapters/active_record_spec.rb @@ -45,6 +45,16 @@ it_should_behave_like 'a flipper adapter' + it "works when table doesn't exist" do + ActiveRecord::Base.connection.execute("DROP table IF EXISTS `flipper_gates`") + + Flipper.configuration = nil + Flipper.instance = nil + + silence_warnings { load 'flipper/adapters/active_record.rb' } + expect { Flipper::Adapters::ActiveRecord.new }.not_to raise_error + end + it "should load actor ids fine" do flipper.enable_percentage_of_time(:foo, 1)