Improve feature toggling

This commit is contained in:
Matt-Yorkley
2023-06-08 19:33:26 +01:00
parent 2f0f3e0820
commit 9b45b71696
4 changed files with 6 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
.medium-6#checkout-payment-methods
- if @order.distributor.vouchers.present?
- if feature?(:vouchers, spree_current_user) && @order.distributor.vouchers.present?
%div.checkout-substep
= render partial: "split_checkout/voucher_section", locals: { order: @order, voucher_adjustment: @order.voucher_adjustments.first }

View File

@@ -707,6 +707,8 @@ describe "As a consumer, I want to checkout my order" do
end
describe "vouchers" do
before { Flipper.enable :vouchers }
context "with no voucher available" do
before do
visit checkout_step_path(:payment)

View File

@@ -106,6 +106,8 @@ describe "As a consumer, I want to see adjustment breakdown" do
end
context "when using a voucher" do
before { Flipper.enable :vouchers }
let!(:voucher) do
create(:voucher, code: 'some_code', enterprise: distributor, amount: 10)
end

View File

@@ -63,6 +63,7 @@ describe "As a consumer, I want to see adjustment breakdown" do
before do
# assures tax is charged in dependence of shipping address
Spree::Config.set(tax_using_ship_address: true)
Flipper.enable :vouchers
end
describe "a not-included tax" do