Sha256: 7db0cc60a00a2adcd849ac00343fceee739639222fe27f18781bd92a0b7ccc17
Contents?: true
Size: 1.54 KB
Versions: 2
Compression:
Stored size: 1.54 KB
Contents
require 'spec_helper' describe NetSuite::Utilities do describe '#get_record' do it 'does not hit the netsuite API when caching is enabled' do ns_account_id = 123 allow(NetSuite::Records::Account).to receive(:get).with(ns_account_id).once.and_return( NetSuite::Records::Account.new(internal_id: ns_account_id) ) ns_account = NetSuite::Utilities.get_record(NetSuite::Records::Account, ns_account_id, cache: true) expect(ns_account.internal_id).to eq(ns_account_id) ns_account = NetSuite::Utilities.get_record(NetSuite::Records::Account, ns_account_id, cache: true) expect(ns_account.internal_id).to eq(ns_account_id) end it 'pulls a record by internal id' do ns_account_id = 123 ns_account_external_id = "abc" allow(NetSuite::Records::Account).to receive(:get).with({ external_id: ns_account_external_id }).once.and_return( NetSuite::Records::Account.new(internal_id: ns_account_id) ) ns_account = NetSuite::Utilities.get_record(NetSuite::Records::Account, ns_account_external_id, external_id: true) expect(ns_account.internal_id).to eq(ns_account_id) end it 'pulls a record by external id' do ns_account_id = 123 allow(NetSuite::Records::Account).to receive(:get).with(ns_account_id).once.and_return( NetSuite::Records::Account.new(internal_id: ns_account_id) ) ns_account = NetSuite::Utilities.get_record(NetSuite::Records::Account, ns_account_id) expect(ns_account.internal_id).to eq(ns_account_id) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
netsuite-0.7.6 | spec/netsuite/utilities_spec.rb |
netsuite-0.7.5 | spec/netsuite/utilities_spec.rb |