spec/endeca/document_spec.rb in primedia-endeca-0.9.24 vs spec/endeca/document_spec.rb in primedia-endeca-0.9.25
- old
+ new
@@ -44,10 +44,15 @@
describe '.find' do
before do
@query_options = {:foo => :bar}
end
+
+ it do
+ Endeca::Document.path nil
+ lambda{ Endeca::Document.find('') }.should raise_error(Endeca::RequestError)
+ end
describe '#==' do
it "should compare documents by id" do
id = 1
doc_1 = Endeca::Document.new
@@ -226,9 +231,23 @@
Endeca::Document.default_params :foo => :bar
Endeca::Request.should_receive(:perform).with(anything, "query string")
Endeca::Document.all("query string")
end
end
+ end
+
+ describe "with a collection_class on the document" do
+ before(:all) do
+ class SubDocumentCollection < Endeca::DocumentCollection; end
+ Endeca::Document.collection_class SubDocumentCollection
+
+ Endeca::Request.stub!(:perform).and_return({})
+ end
+
+ it "should initialize an collection of the correct class" do
+ Endeca::Document.all(:id => 1).should be_a_kind_of(SubDocumentCollection)
+ end
+
end
end
describe ".transform_query_options" do
before do