Sha256: 86badf9a406b43ccaad7d4a55646917b1db1c767b03401a1b1d50a4deffe5d44

Contents?: true

Size: 1.1 KB

Versions: 12

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

describe Query::Solr do

  describe 'real server' do
    before(:each) do
      @server = Query::Solr.new
    end

    describe 'execute' do
      context 'error cases' do
        before(:each) do
          @tokens = stub :tokens
        end
        context 'tokens are malformed' do

        end
        context 'server returns strange values' do

        end
        context 'server raises' do
          before(:each) do
            @server.stub! :select => lambda { raise Solr::RequestError }
          end
          it 'should not fail' do
            @tokens.stub! :to_solr_query => ''

            lambda { @server.execute(@tokens) }.should_not raise_error
          end
        end
      end
    end
  end

  context 'with connected Server' do
    before(:each) do
      @server = stub :server
      RSolr.stub! :connect => @server
    end
  end

  context 'without connected server' do
    before(:each) do
      RSolr.should_receive(:connect).and_raise RuntimeError
    end
    it 'should have a nil server' do
      Query::Solr.new(:some_index_type).server.should == nil
    end
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
picky-0.2.2 spec/lib/query/solr_spec.rb
picky-0.2.1 spec/lib/query/solr_spec.rb
picky-0.2.0 spec/lib/query/solr_spec.rb
picky-0.1.0 spec/lib/query/solr_spec.rb
picky-0.0.9 spec/lib/query/solr_spec.rb
picky-0.0.8 spec/lib/query/solr_spec.rb
picky-0.0.7 spec/lib/query/solr_spec.rb
picky-0.0.6 spec/lib/query/solr_spec.rb
picky-0.0.5 spec/lib/query/solr_spec.rb
picky-0.0.4 spec/lib/query/solr_spec.rb
picky-0.0.3 spec/lib/query/solr_spec.rb
picky-0.0.2 spec/lib/query/solr_spec.rb