Skip to content

Commit

Permalink
remove legacy checkout tests
Browse files Browse the repository at this point in the history
  • Loading branch information
abdellani committed Jun 1, 2023
1 parent 214021f commit f52604d
Show file tree
Hide file tree
Showing 19 changed files with 192 additions and 821 deletions.
1 change: 1 addition & 0 deletions spec/controllers/admin/bulk_line_items_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@

order.refresh_shipment_rates
order.select_shipping_method(shipping_method.id)
OrderWorkflow.new(order).advance_to_payment
order.finalize!
order.recreate_all_fees!
order.create_tax_charge!
Expand Down
28 changes: 10 additions & 18 deletions spec/controllers/payment_gateways/stripe_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,6 @@ module PaymentGateways
order.payments << payment
end

shared_examples "successful order completion" do
it "completes the order and redirects to the order confirmation page" do
expect(controller).to receive(:processing_succeeded).and_call_original
expect(controller).to receive(:order_completion_reset).and_call_original

get :confirm, params: { payment_intent: "pi_123" }

expect(order.completed?).to be true
expect(response).to redirect_to order_path(order, order_token: order.token)
expect(flash[:notice]).to eq 'Your order has been processed successfully'
end
end

include_examples "successful order completion"

it "creates a customer record" do
order.update_columns(customer_id: nil)
Customer.delete_all
Expand Down Expand Up @@ -89,12 +74,19 @@ module PaymentGateways

context "using split checkout" do
before do
Flipper.enable(:split_checkout)

order.update_attribute :state, "confirmation"
end

include_examples "successful order completion"
it "completes the order and redirects to the order confirmation page" do
expect(controller).to receive(:processing_succeeded).and_call_original
expect(controller).to receive(:order_completion_reset).and_call_original

get :confirm, params: { payment_intent: "pi_123" }

expect(order.completed?).to be true
expect(response).to redirect_to order_path(order, order_token: order.token)
expect(flash[:notice]).to eq 'Your order has been processed successfully'
end
end
end

Expand Down
2 changes: 0 additions & 2 deletions spec/controllers/split_checkout_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
let(:shipping_method) { distributor.shipping_methods.first }

before do
Flipper.enable(:split_checkout)

exchange.variants << order.line_items.first.variant
allow(controller).to receive(:current_order) { order }
allow(controller).to receive(:spree_current_user) { user }
Expand Down
4 changes: 0 additions & 4 deletions spec/helpers/injection_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
order = create(:order, distributor: current_distributor)
allow(helper).to receive(:current_order) { order }
allow(helper).to receive(:spree_current_user) { nil }
expect(helper.inject_available_shipping_methods).to match sm.id.to_s
expect(helper.inject_available_shipping_methods).to match sm.compute_amount(order).to_s
end

it "injects payment methods" do
Expand All @@ -47,8 +45,6 @@
order = create(:order, distributor: current_distributor)
allow(helper).to receive(:current_order) { order }
allow(helper).to receive(:spree_current_user) { nil }
expect(helper.inject_available_payment_methods).to match pm.id.to_s
expect(helper.inject_available_payment_methods).to match pm.name
end

it "injects current order" do
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit f52604d

Please sign in to comment.