spec/lib/query/live_spec.rb in picky-1.2.4 vs spec/lib/query/live_spec.rb in picky-1.3.0

- old
+ new

@@ -19,42 +19,13 @@ describe "execute" do before(:each) do @query = Query::Live.new @index end it "should get allocations" do - @query.should_receive(:results_from).and_return stub(:results, :prepare! => true) + @query.result_type.should_receive :from @query.should_receive(:sorted_allocations).once @query.execute 'some_query', 0 - end - it "should generate a max amount of results from allocations" do - allocations = stub :allocations - @query.should_receive(:sorted_allocations).and_return allocations - - @query.should_receive(:results_from).once.with(0, allocations).and_return stub(:results, :prepare! => true) - - @query.execute 'some query', 0 - end - end - - describe "results_from" do - describe "with empty ids" do - before(:each) do - @query = Query::Live.new @index - @allocations = stub :allocations, :total => 0, :ids => [], :to_result => :some_results, :process! => nil - end - it "should generate a result" do - @query.results_from(@allocations).should be_kind_of Results::Live - end - it "should generate a result with 0 result count" do - @query.results_from(@allocations).total.should == 0 - end - it "should generate a result with 0 duration" do - @query.results_from(@allocations).duration.should == 0 - end - it "should generate a result with the allocations" do - @query.results_from(0, @allocations).allocations.should == @allocations - end end end end \ No newline at end of file