mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
Simplify test setup with enabled features
If a feature is activated or not depends on the database which is reset after each test scenario. So enabling a feature doesn't leak into other scenarios. Just enabling the feature is less code and more realistic than mocking a method call.
This commit is contained in:
@@ -16,10 +16,7 @@ describe SplitCheckoutController, type: :controller do
|
||||
let(:shipping_method) { distributor.shipping_methods.first }
|
||||
|
||||
before do
|
||||
allow(OpenFoodNetwork::FeatureToggle).
|
||||
to receive(:enabled?).with(:split_checkout) { true }
|
||||
allow(OpenFoodNetwork::FeatureToggle).
|
||||
to receive(:enabled?).with(:split_checkout, anything) { true }
|
||||
Flipper.enable(:split_checkout)
|
||||
|
||||
exchange.variants << order.line_items.first.variant
|
||||
allow(controller).to receive(:current_order) { order }
|
||||
|
||||
Reference in New Issue
Block a user