Sha256: 81bf035db01294551223e8063668801a1e2c1364a5e1cbd4408a394fc663e352
Contents?: true
Size: 1.87 KB
Versions: 3
Compression:
Stored size: 1.87 KB
Contents
require 'spec_helper' describe Query::Live do before(:each) do # @category1 = Index::Category.new # @type_index = Index::Type.new :some_name, :some_result_type, @category1 @type = stub :type @index = stub :index, :index => @type end describe 'result_type' do before(:each) do @query = Query::Live.new @index end it "should return a specific type" do @query.result_type.should == Results::Live end end 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.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
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
picky-0.11.2 | spec/lib/query/live_spec.rb |
picky-0.11.1 | spec/lib/query/live_spec.rb |
picky-0.11.0 | spec/lib/query/live_spec.rb |