Fix specs

This commit is contained in:
Ahmed Ejaz
2025-10-31 04:40:44 +05:00
parent 895e142e2c
commit 243190491b

View File

@@ -63,15 +63,16 @@ RSpec.describe PaymentGateways::StripeController do
expect(controller).to receive(:current_order_cycle).and_return(order_cycle)
expect(controller).to receive(:current_order).and_return(order).at_least(:once)
expect(order_cycle).to receive(:closed?).and_return(true)
expect(order).to receive(:empty!)
expect(order).to receive(:assign_order_cycle!).with(nil)
expect(order).not_to receive(:empty!)
expect(order).not_to receive(:assign_order_cycle!).with(nil)
get :confirm, params: { payment_intent: "pi_123" }
expect(response).to redirect_to shop_url
expect(flash[:info]).to eq(
"The order cycle you've selected has just closed. Please try again!"
)
message = "The order cycle you've selected has just closed. " \
"Please contact us to complete your order ##{order.number}!"
expect(response).to redirect_to shops_url
expect(flash[:info]).to eq(message)
end
end