Sha256: 96e09246bd982afcbd87359c1e7c66cfb2859bff393b506db4fc24d6e0a2f5a4

Contents?: true

Size: 962 Bytes

Versions: 48

Compression:

Stored size: 962 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Spree::Order do
  context "when an order has an adjustment that zeroes the total, but another adjustment for shipping that raises it above zero" do
    let!(:persisted_order) { create(:order) }
    let!(:line_item) { create(:line_item) }
    let!(:shipping_method) do
      sm = create(:shipping_method)
      sm.calculator.preferred_amount = 10
      sm.save
      sm
    end

    before do
      persisted_order.line_items << line_item
      create(:adjustment, amount: -line_item.amount, label: "Promotion", adjustable: line_item, order: persisted_order)
      persisted_order.state = 'delivery'
      persisted_order.save # To ensure new state_change event
    end

    it "transitions from delivery to payment" do
      allow(persisted_order).to receive_messages(payment_required?: true)
      persisted_order.next!
      expect(persisted_order.state).to eq("payment")
    end
  end
end

Version data entries

48 entries across 48 versions & 2 rubygems

Version Path
solidus_core-2.10.5 spec/models/spree/order/adjustments_spec.rb
solidus_core-2.10.3 spec/models/spree/order/adjustments_spec.rb
solidus_core-2.10.2 spec/models/spree/order/adjustments_spec.rb
solidus_core-2.9.6 spec/models/spree/order/adjustments_spec.rb
solidus_core-2.8.6 spec/models/spree/order/adjustments_spec.rb
solidus_core-2.10.1 spec/models/spree/order/adjustments_spec.rb
solidus_core-2.9.5 spec/models/spree/order/adjustments_spec.rb
solidus_core-2.10.0 spec/models/spree/order/adjustments_spec.rb
solidus_core-2.9.4 spec/models/spree/order/adjustments_spec.rb
solidus_core-2.6.6 spec/models/spree/order/adjustments_spec.rb
solidus_core-2.7.4 spec/models/spree/order/adjustments_spec.rb
solidus_core-2.8.5 spec/models/spree/order/adjustments_spec.rb
solidus_core-2.9.3 spec/models/spree/order/adjustments_spec.rb
solidus_core-2.9.2 spec/models/spree/order/adjustments_spec.rb
solidus_core-2.10.0.beta1 spec/models/spree/order/adjustments_spec.rb
solidus_core-2.7.3 spec/models/spree/order/adjustments_spec.rb
solidus_core-2.6.5 spec/models/spree/order/adjustments_spec.rb
solidus_core-2.9.1 spec/models/spree/order/adjustments_spec.rb
solidus_core-2.9.0 spec/models/spree/order/adjustments_spec.rb
solidus_core-2.9.0.rc.1 spec/models/spree/order/adjustments_spec.rb