spec/endeca/document_spec.rb in primedia-endeca-0.9.14 vs spec/endeca/document_spec.rb in primedia-endeca-0.9.15
- old
+ new
@@ -163,9 +163,18 @@
should_receive(:new).
with(:document)
Endeca::Document.first(:id => '1234')
end
+ it "should instantiate a new Endeca::Document from the first record in the response hash with aggregate results" do
+ hash = {'AggrRecords' => [{'Records' => [:document]}]}
+ Endeca::Request.stub!(:perform).and_return(hash)
+ Endeca::Document.
+ should_receive(:new).
+ with(:document)
+ Endeca::Document.first(:id => '1234')
+ end
+
describe "when no matching record is returned" do
it "should be nil" do
Endeca::Request.stub!(:perform).and_return({'Records' => nil})
Endeca::Document.first(:id => '1234').should be_nil
end