Sha256: b0bf4a13ef9eb9704e6dbfaad224dd3be6f40494d621fbd087665be1717293cf
Contents?: true
Size: 1.59 KB
Versions: 8
Compression:
Stored size: 1.59 KB
Contents
RSpec.describe SolidusBacktracs::Shipment::BetweenQuery do describe '.apply' do it 'returns shipments whose updated_at falls within the given time range' do shipment = create(:shipment) { |s| s.update_column(:updated_at, Time.zone.now) } result = described_class.apply( Spree::Shipment.all, from: Time.zone.yesterday, to: Time.zone.tomorrow, ) expect(result).to eq([shipment]) end it "returns shipments whose order's updated_at falls within the given time range" do order = create(:order) { |o| o.update_column(:updated_at, Time.zone.now) } shipment = create(:shipment, order: order) result = described_class.apply( Spree::Shipment.all, from: Time.zone.yesterday, to: Time.zone.tomorrow, ) expect(result).to eq([shipment]) end it 'does not return shipments whose updated_at does not fall within the given time range' do create(:shipment) { |s| s.update_column(:updated_at, Time.zone.now) } result = described_class.apply( Spree::Shipment.all, from: Time.zone.tomorrow, to: Time.zone.tomorrow + 1.day, ) expect(result).to eq([]) end it "does not return shipments whose order's updated_at falls within the given time range" do order = create(:order) { |o| o.update_column(:updated_at, Time.zone.now) } create(:shipment, order: order) result = described_class.apply( Spree::Shipment.all, from: Time.zone.tomorrow, to: Time.zone.tomorrow + 1.day, ) expect(result).to eq([]) end end end
Version data entries
8 entries across 8 versions & 2 rubygems