Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for advancing carts correctly in admin checkout #4253

Merged
merged 3 commits into from
Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def update
end

unless @order.completed?
@order.next
@order.contents.advance
@order.refresh_shipment_rates
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@

context "#update" do
let(:order) { create(:order, number: "R123456789") }
let(:contents) { order.contents }

before { allow(Spree::Order).to receive_message_chain(:includes, :find_by!) { order } }

it "updates + progresses the order" do
expect(order).to receive(:update) { true }
expect(order).to receive(:next) { false }
it "updates + advances the order" do
expect(contents).to receive(:update_cart) { true }
expect(contents).to receive(:advance) { false }
attributes = { order_id: order.number, order: { email: "" } }
put :update, params: attributes
end
Expand Down
4 changes: 2 additions & 2 deletions backend/spec/features/admin/orders/new_order_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,15 @@
user.wallet.add(credit_card)
end

it "transitions to delivery not to complete" do
it "transitions to confirm not to complete" do
add_line_item product.name

expect(page).to have_css('.line-item')

click_link "Customer"
targetted_select2 user.email, from: "#s2id_customer_search"
click_button "Update"
expect(page).to have_css('.order-state', text: 'Delivery')
expect(page).to have_css('.order-state', text: 'Confirm')
end
end

Expand Down