Sha256: 28a972d4566309716f2e0d32af87922d3486c5cf1466c1f5d7ae52ef6ef12c41

Contents?: true

Size: 944 Bytes

Versions: 2

Compression:

Stored size: 944 Bytes

Contents

RSpec.shared_context 'when order is ready for payment' do
  let!(:country) { create :country }

  let(:user) { create :user }

  let(:address) do
    create :solidus_braintree_address,
      :with_first_and_last_name,
      zipcode: "90210",
      lastname: "Doe",
      country: country
  end

  before do
    create :shipping_method, cost: 5
  end

  let(:gateway) do
    new_gateway(auto_capture: true)
  end

  let(:order) do
    order = Spree::Order.create!(
      line_items: [create(:line_item, price: 50)],
      email: 'test@example.com',
      bill_address: address,
      ship_address: address,
      user: user
    )
    order.recalculate

    expect(order.state).to eq "cart"

    # push through cart, address and delivery
    # its sadly unsafe to use any reasonable factory here accross
    # supported solidus versions
    order.next!
    order.next!
    order.next!

    expect(order.state).to eq "payment"
    order
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solidus_braintree-3.0.1 spec/support/solidus_braintree/order_ready_for_payment.rb
solidus_braintree-3.0.0 spec/support/solidus_braintree/order_ready_for_payment.rb