mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-04 22:16:08 +00:00
Specs for the new action complete after capture
- In admin dashboard, clicking on capture leads to a completed order - Modifications of actual specs to take into account new action
This commit is contained in:
@@ -28,14 +28,14 @@ module Spree
|
||||
it "should be true if payment is pending" do
|
||||
payment = build_stubbed(:payment, created_at: Time.zone.now)
|
||||
allow(payment).to receive(:pending?) { true }
|
||||
expect(credit_card.can_capture?(payment)).to be_truthy
|
||||
expect(credit_card.can_capture_and_complete_order?(payment)).to be_truthy
|
||||
end
|
||||
|
||||
it "should be true if payment is checkout" do
|
||||
payment = build_stubbed(:payment, created_at: Time.zone.now)
|
||||
allow(payment).to receive_messages pending?: false,
|
||||
checkout?: true
|
||||
expect(credit_card.can_capture?(payment)).to be_truthy
|
||||
expect(credit_card.can_capture_and_complete_order?(payment)).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -812,7 +812,7 @@ describe Spree::Payment do
|
||||
let(:payment) { build_stubbed(:payment, source: build_stubbed(:credit_card)) }
|
||||
|
||||
it "can capture and void" do
|
||||
expect(payment.actions).to match_array %w(capture void)
|
||||
expect(payment.actions).to match_array %w(capture_and_complete_order void)
|
||||
end
|
||||
|
||||
describe "when a payment has been taken" do
|
||||
|
||||
@@ -9,6 +9,7 @@ describe '
|
||||
include AuthenticationHelper
|
||||
|
||||
let(:order) { create(:completed_order_with_fees) }
|
||||
let(:confirmed_order) { create(:order_ready_for_confirmation) }
|
||||
|
||||
describe "payments/new" do
|
||||
it "displays the order balance as the default payment amount" do
|
||||
@@ -67,4 +68,14 @@ describe '
|
||||
expect(order.shipment_state).to eq "pending"
|
||||
end
|
||||
end
|
||||
|
||||
describe 'Capture & complete order' do
|
||||
it 'completes order when capturing payment' do
|
||||
login_as_admin
|
||||
visit spree.admin_order_payments_path confirmed_order
|
||||
expect(page).to have_content "CHECKOUT"
|
||||
page.find('a.icon-capture_and_complete_order').click
|
||||
expect(confirmed_order.reload.state).to eq 'complete'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user