spec/netsuite/utilities_spec.rb in netsuite-0.7.9 vs spec/netsuite/utilities_spec.rb in netsuite-0.8.0

- old
+ new

@@ -1,7 +1,19 @@ require 'spec_helper' describe NetSuite::Utilities do + describe 'time utilities' do + it '#normalize_time_to_netsuite_date' do + stamp = DateTime.parse('Wed, 27 Jul 2016 00:00:00 -0000') + formatted_date = NetSuite::Utilities.normalize_time_to_netsuite_date(stamp.to_time.to_i) + expect(formatted_date).to eq('2016-07-27T00:00:00-07:00') + + no_dst_stamp = DateTime.parse('Sun, November 6 2017 00:00:00 -0000') + formatted_date = NetSuite::Utilities.normalize_time_to_netsuite_date(no_dst_stamp.to_time.to_i) + expect(formatted_date).to eq('2017-11-06T00:00:00-08:00') + end + end + describe '#get_record' do context 'caching' do it 'does not hit the netsuite API' do ns_account_id = 123 allow(NetSuite::Records::Account).to receive(:get).with(ns_account_id).once.and_return(