Sha256: e5154f158fc0af8b4723a5a9f65af99da7648e55c410cd40b6f0398749242d25

Contents?: true

Size: 1.78 KB

Versions: 60

Compression:

Stored size: 1.78 KB

Contents

require 'spec_helper'

describe NetSuite::Records::JournalEntryLine do
  let(:line) { NetSuite::Records::JournalEntryLine.new }

  it 'has all the right fields' do
    [
      :credit, :debit, :eliminate, :end_date, :gross_amt, :memo, :residual, :start_date, :tax1_amt, :tax_rate1
    ].each do |field|
      expect(line).to have_field(field)
    end
  end

  it 'has all the right record refs' do
    [
      :account, :department, :entity, :klass, :location, :schedule, :schedule_num, :tax1_acct, :tax_code
    ].each do |record_ref|
      expect(line).to have_record_ref(record_ref)
    end
  end

  describe '#custom_field_list' do
    it 'can be set from attributes' do
      attributes = {
        :custom_field => {
          :amount => 10,
          :internal_id => 'custfield_amount'
        }
      }
      line.custom_field_list = attributes
      expect(line.custom_field_list).to be_kind_of(NetSuite::Records::CustomFieldList)
      expect(line.custom_field_list.custom_fields.length).to eql(1)
    end

    it 'can be set from a CustomFieldList object' do
      custom_field_list = NetSuite::Records::CustomFieldList.new
      line.custom_field_list = custom_field_list
      expect(line.custom_field_list).to eql(custom_field_list)
    end
  end

  describe '#to_record' do
    let(:line) { NetSuite::Records::JournalEntryLine.new(:memo => 'This is a memo', :eliminate => true) }

    it 'returns a hash of attributes that can be used in a SOAP request' do
      expect(line.to_record).to eql({
        'tranGeneral:memo'      => 'This is a memo',
        'tranGeneral:eliminate' => true
      })
    end
  end

  describe '#record_type' do
    it 'returns a string type for the record to be used in a SOAP request' do
      expect(line.record_type).to eql('tranGeneral:JournalEntryLine')
    end
  end

end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
netsuite-0.9.3 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.9.2 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.9.1 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.9.0 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.8.12 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.8.11 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.8.10 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.8.9 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.8.8 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.8.7 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.8.6 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.8.5 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.8.4 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.8.3 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.8.2 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.8.1 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.8.0 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.7.9 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.7.8 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.7.7 spec/netsuite/records/journal_entry_line_spec.rb