Sha256: 7016b7a48f29aeff3b866e918ac3f303a30ed904f47269638400ecb882f08282

Contents?: true

Size: 1.36 KB

Versions: 15

Compression:

Stored size: 1.36 KB

Contents

# frozen_string_literal: true

RSpec.describe Spree::Shipment do
  describe '.between' do
    it 'delegates to BetweenQuery' do
      shipment = build_stubbed(:shipment)
      allow(SolidusBactracs::Shipment::BetweenQuery).to receive(:apply).with(
        any_args,
        from: Time.zone.yesterday,
        to: Time.zone.today,
      ).and_return([shipment])

      result = Spree::Deprecation.silence do
        described_class.between(Time.zone.yesterday, Time.zone.today)
      end

      expect(result).to eq([shipment])
    end

    it 'prints a deprecation warning' do
      allow(Spree::Deprecation).to receive(:warn)

      described_class.between(Time.zone.yesterday, Time.zone.today)

      expect(Spree::Deprecation).to have_received(:warn).with(/Spree::Shipment\.between/)
    end
  end

  describe '.exportable' do
    it 'delegates to ExportableQuery' do
      shipment = build_stubbed(:shipment)
      allow(SolidusBactracs::Shipment::ExportableQuery).to receive(:apply).and_return([shipment])

      result = Spree::Deprecation.silence do
        described_class.exportable
      end

      expect(result).to eq([shipment])
    end

    it 'prints a deprecation warning' do
      allow(Spree::Deprecation).to receive(:warn)

      described_class.exportable

      expect(Spree::Deprecation).to have_received(:warn).with(/Spree::Shipment\.exportable/)
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
solidus_bactracs-4.0.1 spec/models/spree/shipment_spec.rb
solidus_bactracs-4.0.0 spec/models/spree/shipment_spec.rb
solidus_bactracs-3.5.2 spec/models/spree/shipment_spec.rb
solidus_bactracs-3.5.1 spec/models/spree/shipment_spec.rb
solidus_bactracs-3.5.0 spec/models/spree/shipment_spec.rb
solidus_bactracs-3.4.0 spec/models/spree/shipment_spec.rb
solidus_bactracs-3.3.2 spec/models/spree/shipment_spec.rb
solidus_bactracs-3.3.1 spec/models/spree/shipment_spec.rb
solidus_bactracs-3.3.0 spec/models/spree/shipment_spec.rb
solidus_bactracs-3.2.2 spec/models/spree/shipment_spec.rb
solidus_bactracs-3.2.1 spec/models/spree/shipment_spec.rb
solidus_bactracs-3.2.0 spec/models/spree/shipment_spec.rb
solidus_bactracs-3.1.2 spec/models/spree/shipment_spec.rb
solidus_bactracs-3.1.1 spec/models/spree/shipment_spec.rb
solidus_bactracs-3.1.0 spec/models/spree/shipment_spec.rb