How to handle strict adapter with test? #807
Replies: 2 comments 1 reply
-
Hey @iseth, this is a good question and something we're still personally experimenting with since the strict adapter is so new. Our testing docs actually recommend overwriting Flipper's However, I would like to move to a setup where we're using the Strict adapter in tests, with it configured to class ActiveSupport::TestCase
setup do
Flipper.instance = nil
Flipper.add :feature_1
Flipper.add :feature_2
end
end |
Beta Was this translation helpful? Give feedback.
-
We have the following in begin
if ActiveRecord::Base.connection.data_source_exists?('flipper_features')
Flipper.add(:realty_import)
Flipper.add(:portfolio)
end
rescue ActiveRecord::NoDatabaseError
Rails.logger.error('DB doesn\'t exist yet')
end This adds the features at boot, but needs a workaround in case that there isn't a DB available yet (first time setup). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
this is related to: #763
What is the expected way to handle the strict adapter in tests?
Should I add all the flipper features in a fixture or in an initializer file?
It mentions this in the docs:
https://www.flippercloud.io/docs/guides/launch#add-feature-flags-to-your-app
It makes it seem like just adding the conditionals like
Flipper.enabled? :new_feature
is all you need to add a flipper feature, but in tests this warns:Beta Was this translation helpful? Give feedback.
All reactions