spec/netsuite/support/search_result_spec.rb in netsuite-0.8.10 vs spec/netsuite/support/search_result_spec.rb in netsuite-0.8.11

- old
+ new

@@ -1,8 +1,11 @@ require 'spec_helper' describe NetSuite::Support::SearchResult do + before(:all) { savon.mock! } + after(:all) { savon.unmock! } + describe '#results' do context 'empty page' do it 'returns empty array' do response_body = { :status => {:@is_success=>"true"}, @@ -17,8 +20,17 @@ response = NetSuite::Response.new(body: response_body) results = described_class.new(response, NetSuite::Actions::Search, {}).results expect(results).to eq [] end + end + + it 'handles a recordList with a single element' do + response = File.read('spec/support/fixtures/search/single_search_result.xml') + savon.expects(:search).with(message: {}).returns(response) + + results = NetSuite::Records::Account.search(basic: []) + + expect(results.results.count).to eq 1 end end end