Sha256: 49febd9af4290d962fed761f72da2293a790f6301c7b290cf990494779a7c217

Contents?: true

Size: 983 Bytes

Versions: 47

Compression:

Stored size: 983 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe "Cancel items" 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 items are cancelable" do
    it "can cancel the item" do
      visit_order

      click_link 'Cancel Items'

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

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

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

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

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

Version data entries

47 entries across 47 versions & 2 rubygems

Version Path
solidus_backend-2.10.5 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-2.10.3 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-2.10.2 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-2.9.6 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-2.8.6 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-2.10.1 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-2.9.5 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-2.10.0 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-2.9.4 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-2.6.6 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-2.7.4 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-2.8.5 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-2.9.3 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-2.9.2 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-2.10.0.beta1 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-2.7.3 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-2.6.5 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-2.9.1 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-2.9.0 spec/features/admin/orders/cancelling_inventory_spec.rb
solidus_backend-2.9.0.rc.1 spec/features/admin/orders/cancelling_inventory_spec.rb