Sha256: 3426d64cd250674046a768a49036c4556c7c52d03d63e443e1cbfb0e620fadea
Contents?: true
Size: 1.59 KB
Versions: 15
Compression:
Stored size: 1.59 KB
Contents
RSpec.describe SolidusBactracs::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
15 entries across 15 versions & 1 rubygems