Sha256: 59da6851f52b25988a877f2f251c46d10b22e2cd1506fa02521b6de68abbb48d

Contents?: true

Size: 1.05 KB

Versions: 10

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

describe "Cancelling + Resuming", :type => :feature do

  stub_authorization!

  let(:user) { double(id: 123, has_spree_role?: true, spree_api_key: 'fake') }

  before do
    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
      within(".state") do
        expect(page).to have_content("canceled")
      end
    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
        within(".state") do
          expect(page).to have_content("resumed")
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
spree_backend-3.1.5 spec/features/admin/orders/cancelling_and_resuming_spec.rb
spree_backend-3.1.4 spec/features/admin/orders/cancelling_and_resuming_spec.rb
spree_backend-3.1.3 spec/features/admin/orders/cancelling_and_resuming_spec.rb
spree_backend-3.1.2 spec/features/admin/orders/cancelling_and_resuming_spec.rb
spree_backend-3.1.1 spec/features/admin/orders/cancelling_and_resuming_spec.rb
spree_backend-3.1.0 spec/features/admin/orders/cancelling_and_resuming_spec.rb
spree_backend-3.1.0.rc4 spec/features/admin/orders/cancelling_and_resuming_spec.rb
spree_backend-3.1.0.rc3 spec/features/admin/orders/cancelling_and_resuming_spec.rb
spree_backend-3.1.0.rc2 spec/features/admin/orders/cancelling_and_resuming_spec.rb
spree_backend-3.1.0.rc1 spec/features/admin/orders/cancelling_and_resuming_spec.rb