Sha256: 3b3175b8564dee2dfa6e9e4a0f6e88d29663724b0a67c68e23d1e1f41b205653

Contents?: true

Size: 1.07 KB

Versions: 11

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

describe "Cancelling + Resuming", type: :feature do
  stub_authorization!

  let(:user) { build_stubbed(:user, id: 123, spree_api_key: 'fake') }

  before do
    allow(user).to receive(:has_spree_role?).and_return(true)
    allow_any_instance_of(Spree::Admin::BaseController).to receive(:try_spree_current_user).and_return(user)
  end

  let(:order) do
    order = create(:order)
    order.update_columns({
      state: 'complete',
      completed_at: Time.current
    })
    order
  end

  it "can cancel an order" do
    visit spree.edit_admin_order_path(order.number)
    click_button 'Cancel'
    within(".additional-info") do
      expect(find('dt#order_status + dd')).to have_content("Canceled")
    end
  end

  context "with a cancelled order" do
    before do
      order.update_column(:state, 'canceled')
    end

    it "can resume an order" do
      visit spree.edit_admin_order_path(order.number)
      click_button 'Resume'
      within(".additional-info") do
        expect(find('dt#order_status + dd')).to have_content("Resumed")
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
solidus_backend-2.5.2 spec/features/admin/orders/cancelling_and_resuming_spec.rb
solidus_backend-2.5.1 spec/features/admin/orders/cancelling_and_resuming_spec.rb
solidus_backend-2.5.0 spec/features/admin/orders/cancelling_and_resuming_spec.rb
solidus_backend-2.5.0.rc1 spec/features/admin/orders/cancelling_and_resuming_spec.rb
solidus_backend-2.5.0.beta2 spec/features/admin/orders/cancelling_and_resuming_spec.rb
solidus_backend-2.5.0.beta1 spec/features/admin/orders/cancelling_and_resuming_spec.rb
solidus_backend-2.4.2 spec/features/admin/orders/cancelling_and_resuming_spec.rb
solidus_backend-2.4.1 spec/features/admin/orders/cancelling_and_resuming_spec.rb
solidus_backend-2.4.0 spec/features/admin/orders/cancelling_and_resuming_spec.rb
solidus_backend-2.4.0.rc1 spec/features/admin/orders/cancelling_and_resuming_spec.rb
solidus_backend-2.4.0.beta1 spec/features/admin/orders/cancelling_and_resuming_spec.rb