Sha256: 1be5a716543a84b8a33e59111cda6c2dee087fd040cf77839713ff720c264a8c

Contents?: true

Size: 1.17 KB

Versions: 10

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

describe "checkout with unshippable items", type: :feature, inaccessible: true do
  let!(:stock_location) { create(:stock_location) }
  let(:order) { OrderWalkthrough.up_to(:delivery) }

  before do
    OrderWalkthrough.add_line_item!(order)
    line_item = order.line_items.last
    stock_item = stock_location.stock_item(line_item.variant)
    stock_item.adjust_count_on_hand -999
    stock_item.backorderable = false
    stock_item.save!

    user = create(:user)
    order.user = user
    order.update!

    allow_any_instance_of(Spree::CheckoutController).to receive_messages(:current_order => order)
    allow_any_instance_of(Spree::CheckoutController).to receive_messages(:try_spree_current_user => user)
    allow_any_instance_of(Spree::CheckoutController).to receive_messages(:skip_state_validation? => true)
    allow_any_instance_of(Spree::CheckoutController).to receive_messages(:ensure_sufficient_stock_lines => true)
  end

  it 'displays and removes' do
    visit spree.checkout_state_path(:delivery)
    expect(page).to have_content('Unshippable Items')

    click_button "Save and Continue"

    order.reload
    expect(order.line_items.count).to eq 1
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
spree_frontend-3.0.10 spec/features/checkout_unshippable_spec.rb
spree_frontend-3.0.9 spec/features/checkout_unshippable_spec.rb
spree_frontend-3.0.8 spec/features/checkout_unshippable_spec.rb
spree_frontend-3.0.7 spec/features/checkout_unshippable_spec.rb
spree_frontend-3.0.6.1 spec/features/checkout_unshippable_spec.rb
spree_frontend-3.0.6 spec/features/checkout_unshippable_spec.rb
spree_frontend-3.0.5 spec/features/checkout_unshippable_spec.rb
spree_frontend-3.0.4 spec/features/checkout_unshippable_spec.rb
spree_frontend-3.0.3 spec/features/checkout_unshippable_spec.rb
spree_frontend-3.0.2 spec/features/checkout_unshippable_spec.rb