Sha256: e5d3c7548d8d99a450379e2b1e5f4d98f1fe86d65f60ee327a044fc095159786

Contents?: true

Size: 1.07 KB

Versions: 13

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

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

  let(:user) { create(:user) }

  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

13 entries across 13 versions & 1 rubygems

Version Path
solidus_backend_devise_token_auth-2.8.0.alpha.14 spec/features/admin/orders/cancelling_and_resuming_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.13 spec/features/admin/orders/cancelling_and_resuming_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.12 spec/features/admin/orders/cancelling_and_resuming_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.11 spec/features/admin/orders/cancelling_and_resuming_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.10 spec/features/admin/orders/cancelling_and_resuming_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.9 spec/features/admin/orders/cancelling_and_resuming_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.8 spec/features/admin/orders/cancelling_and_resuming_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.7 spec/features/admin/orders/cancelling_and_resuming_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.6 spec/features/admin/orders/cancelling_and_resuming_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.5 spec/features/admin/orders/cancelling_and_resuming_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.4 spec/features/admin/orders/cancelling_and_resuming_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.3 spec/features/admin/orders/cancelling_and_resuming_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.2 spec/features/admin/orders/cancelling_and_resuming_spec.rb