Check feature name in specs

There was one case where a typo meant that the desired feature wasn't
active and tests were not testing the right code path. Using this new
syntax should prevent that.

* https://github.com/openfoodfoundation/openfoodnetwork/pull/11705
This commit is contained in:
Maikel Linke
2023-11-17 11:39:10 +11:00
parent d841b1dae2
commit 6f3bee708c

View File

@@ -92,7 +92,13 @@ RSpec.configure do |config|
end
config.before(:each, :feature) do |example|
Flipper.enable(example.metadata[:feature])
feature = example.metadata[:feature].to_s
unless OpenFoodNetwork::FeatureToggle::CURRENT_FEATURES.key?(feature)
raise "Unkown feature: #{feature}"
end
Flipper.enable(feature)
end
# Enable caching in any specs tagged with `caching: true`.