spec/netsuite/actions/search_spec.rb in netsuite-0.2.5 vs spec/netsuite/actions/search_spec.rb in netsuite-0.2.6

- old
+ new

@@ -15,33 +15,35 @@ expect(instance.class_name).to eq NetSuite::Records::InventoryItem.search_class_name end end context "saved search" do - before do - savon.expects(:search).with(:message => { - 'searchRecord' => { - '@xsi:type' => 'listRel:CustomerSearchAdvanced', - '@savedSearchId' => 500, - :content! => { "listRel:criteria" => {} } - }, - }).returns(File.read('spec/support/fixtures/search/saved_search_customer.xml')) - end + context "with no params" do + before do + savon.expects(:search).with(:message => { + 'searchRecord' => { + '@xsi:type' => 'listRel:CustomerSearchAdvanced', + '@savedSearchId' => 500, + :content! => { "listRel:criteria" => {} } + }, + }).returns(File.read('spec/support/fixtures/search/saved_search_customer.xml')) + end - it "should handle a ID only search" do - result = NetSuite::Records::Customer.search(saved: 500) - result.results.size.should == 1 - result.results.first.email.should == 'aemail@gmail.com' - end + it "should handle a ID only search" do + result = NetSuite::Records::Customer.search(saved: 500) + result.results.size.should == 1 + result.results.first.email.should == 'aemail@gmail.com' + end - it "merges preferences gracefully" do - expect { - NetSuite::Records::Customer.search( - saved: 500, - preferences: { page_size: 20 } - ) - }.not_to raise_error + it "merges preferences gracefully" do + expect { + NetSuite::Records::Customer.search( + saved: 500, + preferences: { page_size: 20 } + ) + }.not_to raise_error + end end skip "should handle a ID search with basic params" skip "should handle a search with joined params" @@ -52,26 +54,22 @@ '@savedSearchId' => 500, :content! => { "listRel:criteria" => { "listRel:basic" => { "platformCommon:entityId" => { - "platformCore:searchValue" => "New Keywords" + :content! => {"platformCore:searchValue" => "New Keywords"}, + :"@operator" => "hasKeywords" }, - - :attributes! => { - "platformCommon:entityId" => { "operator" => "hasKeywords" }, - "platformCommon:stage" => { "operator" => "anyOf" } + "platformCommon:stage" => { + :content! => {"platformCore:searchValue"=>["_lead", "_customer"]}, + :"@operator" => "anyOf" }, - - "platformCommon:stage" => { "platformCore:searchValue" => ["_lead", "_customer"] }, "platformCommon:customFieldList" => { "platformCore:customField" => [ { - "platformCore:searchValue" => [{}, {}], + "platformCore:searchValue" => [{:"@internalId" => 4}, {:"@internalId" => 11}], :attributes! => { - "platformCore:searchValue" => { - "internalId" => [4, 11] - } + "platformCore:searchValue" => { "internalId" => [4, 11] } } }, { "platformCore:searchValue" => [{}], :attributes! => {