Sha256: 859cc647ff770613c99a6871ad46938db0574ad5eb71e2eea5c03e5640a62cda

Contents?: true

Size: 833 Bytes

Versions: 15

Compression:

Stored size: 833 Bytes

Contents

RSpec.describe SolidusBactracs::Api::ShipmentSerializer do
  describe '#call' do
    it 'serializes the shipment' do
      shipment = create(:order_ready_to_ship).shipments.first

      serializer = described_class.new(store_id: '12345678')
      result = serializer.call(shipment)

      expect(result).to be_instance_of(Hash)
    end

    it 'sets residential = false in address if company is given' do
      order = create(:order_ready_to_ship,
        bill_address: build(:address, company: 'ACME Co.'),
        ship_address: build(:address, company: nil))
      shipment = order.shipments.first

      serializer = described_class.new(store_id: '12345678')
      result = serializer.call(shipment)

      expect(result[:billTo][:residential]).to be false
      expect(result[:shipTo][:residential]).to be true
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
solidus_bactracs-4.0.1 spec/lib/solidus_bactracs/api/shipment_serializer_spec.rb
solidus_bactracs-4.0.0 spec/lib/solidus_bactracs/api/shipment_serializer_spec.rb
solidus_bactracs-3.5.2 spec/lib/solidus_bactracs/api/shipment_serializer_spec.rb
solidus_bactracs-3.5.1 spec/lib/solidus_bactracs/api/shipment_serializer_spec.rb
solidus_bactracs-3.5.0 spec/lib/solidus_bactracs/api/shipment_serializer_spec.rb
solidus_bactracs-3.4.0 spec/lib/solidus_bactracs/api/shipment_serializer_spec.rb
solidus_bactracs-3.3.2 spec/lib/solidus_bactracs/api/shipment_serializer_spec.rb
solidus_bactracs-3.3.1 spec/lib/solidus_bactracs/api/shipment_serializer_spec.rb
solidus_bactracs-3.3.0 spec/lib/solidus_bactracs/api/shipment_serializer_spec.rb
solidus_bactracs-3.2.2 spec/lib/solidus_bactracs/api/shipment_serializer_spec.rb
solidus_bactracs-3.2.1 spec/lib/solidus_bactracs/api/shipment_serializer_spec.rb
solidus_bactracs-3.2.0 spec/lib/solidus_bactracs/api/shipment_serializer_spec.rb
solidus_bactracs-3.1.2 spec/lib/solidus_bactracs/api/shipment_serializer_spec.rb
solidus_bactracs-3.1.1 spec/lib/solidus_bactracs/api/shipment_serializer_spec.rb
solidus_bactracs-3.1.0 spec/lib/solidus_bactracs/api/shipment_serializer_spec.rb