Sha256: bee2cd2f95861597217db96c7a801b65146754c1ece057b955db90eb3934afd1

Contents?: true

Size: 1.75 KB

Versions: 12

Compression:

Stored size: 1.75 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|
      line.should 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|
      line.should 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
      line.custom_field_list.should be_kind_of(NetSuite::Records::CustomFieldList)
      line.custom_field_list.custom_fields.length.should 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
      line.custom_field_list.should 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
      line.to_record.should 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
      line.record_type.should eql('tranGeneral:JournalEntryLine')
    end
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
netsuite-0.3.0 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.2.6 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.2.5 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.2.4 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.2.3 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.2.2 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.2.1 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.2.0 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.1.0 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.0.50 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.0.49 spec/netsuite/records/journal_entry_line_spec.rb
netsuite-0.0.48 spec/netsuite/records/journal_entry_line_spec.rb