Sha256: bb65f88afa87cf26c1c1d12e7f982572f14ff298b0eea9b700dc1349838349ec

Contents?: true

Size: 1.78 KB

Versions: 43

Compression:

Stored size: 1.78 KB

Contents

require 'spec_helper'

describe NetSuite::Records::InventoryTransfer do
  let(:inventory_transfer) { NetSuite::Records::InventoryTransfer.new }

  it 'has all the right fields' do
    [
      :created_date, :last_modified_date, :tran_date, :tran_id, :memo
    ].each do |field|
      expect(inventory_transfer).to have_field(field)
    end
  end

  it 'has all the right record refs' do
    [
      :posting_period, :location, :transfer_location, :department, :subsidiary
    ].each do |record_ref|
      expect(inventory_transfer).to have_record_ref(record_ref)
    end
  end


  describe '#inventory_list' do
    it 'can be set from attributes' do
      attributes = {
        :inventory => [{
          :inventory_detail => {
            :custom_form => {
              internal_id: 1
            },
            :inventory_assignment_list => {
              :inventory_assignment => [{
                quantity: 3
              }]
            }
          }
        }]
      }
      inventory_transfer.inventory_list = attributes
      expect(inventory_transfer.inventory_list).to be_kind_of(NetSuite::Records::InventoryTransferInventoryList)
      expect(inventory_transfer.inventory_list.inventory.length).to eql(1)

      expect(
        inventory_transfer.inventory_list.inventory.first.inventory_detail.inventory_assignment_list.inventory_assignment.first.quantity
      ).to eq(3)

      expect(
        inventory_transfer.inventory_list.inventory.first.inventory_detail.custom_form.internal_id
      ).to eq(1)
    end

    it 'can be set from a InventoryTransferInventoryList object' do
      inventory_list = NetSuite::Records::InventoryTransferInventoryList.new
      inventory_transfer.inventory_list = inventory_list
      expect(inventory_transfer.inventory_list).to eql(inventory_list)
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
netsuite-0.5.9 spec/netsuite/records/inventory_transfer_spec.rb
netsuite-0.5.8 spec/netsuite/records/inventory_transfer_spec.rb
netsuite-0.5.7 spec/netsuite/records/inventory_transfer_spec.rb
netsuite-0.5.6 spec/netsuite/records/inventory_transfer_spec.rb
netsuite-0.5.5 spec/netsuite/records/inventory_transfer_spec.rb
netsuite-0.5.4 spec/netsuite/records/inventory_transfer_spec.rb
netsuite-0.5.3 spec/netsuite/records/inventory_transfer_spec.rb
netsuite-0.5.2 spec/netsuite/records/inventory_transfer_spec.rb
netsuite-0.5.1 spec/netsuite/records/inventory_transfer_spec.rb
netsuite-0.5.0 spec/netsuite/records/inventory_transfer_spec.rb
netsuite-0.4.9 spec/netsuite/records/inventory_transfer_spec.rb
netsuite-0.4.8 spec/netsuite/records/inventory_transfer_spec.rb
netsuite-0.4.7 spec/netsuite/records/inventory_transfer_spec.rb
netsuite-0.4.6 spec/netsuite/records/inventory_transfer_spec.rb
netsuite-0.4.5 spec/netsuite/records/inventory_transfer_spec.rb
netsuite-0.4.4 spec/netsuite/records/inventory_transfer_spec.rb
netsuite-0.4.3 spec/netsuite/records/inventory_transfer_spec.rb
netsuite-0.4.2 spec/netsuite/records/inventory_transfer_spec.rb
netsuite-0.4.1 spec/netsuite/records/inventory_transfer_spec.rb
netsuite-0.4.0 spec/netsuite/records/inventory_transfer_spec.rb