Sha256: 5844caa8a618b280d7780fab50df00ddf4be7d7da2fea7d13951e3ba1fba8909

Contents?: true

Size: 987 Bytes

Versions: 6

Compression:

Stored size: 987 Bytes

Contents

require 'spec_helper'

describe "Cancelling inventory" do
  stub_authorization!

  let!(:order) do
    create(
      :order_ready_to_ship,
      number: "R100",
      state: "complete",
      line_items_count: 1
    )
  end

  def visit_order
    visit spree.admin_path
    click_link "Orders"
    within_row(1) do
      click_link "R100"
    end
  end

  context "when some inventory is cancelable" do
    it "can cancel the inventory" do
      visit_order

      click_link 'Cancel Inventory'

      within_row(1) do
        check 'inventory_unit_ids[]'
      end

      click_button "Cancel Inventory"
      expect(page).to have_content("Inventory canceled")
      expect(page).to have_content("1 x canceled")
    end
  end

  context "when all inventory is not cancelable" do
    before { order.inventory_units.each(&:cancel!) }

    it "does not display the link to cancel inventory" do
      visit_order

      expect(page).to have_no_content('Cancel Inventory')
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
solidus_backend-1.3.2 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-1.3.1 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-1.3.0 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-1.3.0.rc2 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-1.3.0.rc1 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-1.3.0.beta1 spec/features/admin/orders/cancelling_inventory_spec.rb