Sha256: 79a12c46f8c3f324085a46f1a83f39a17ed40c1db6f3b971e2f165f7d221b2b3

Contents?: true

Size: 1.74 KB

Versions: 8

Compression:

Stored size: 1.74 KB

Contents

require 'spec_helper'

describe "Protocol Buffers" do
  before do
    @pbc_port ||= test_server.pb_port
    @http_port ||= test_server.http_port
    @client = Riak::Client.new(:http_port => @http_port, :pb_port => @pbc_port, :protocol => "pbc")
  end

  [:BeefcakeProtobuffsBackend].each do |klass|
    bklass = Riak::Client.const_get(klass)
    if bklass.configured?
      describe klass.to_s do
        before do
          @backend = bklass.new(@client, @client.node)
        end

        it_should_behave_like "Unified backend API"

        describe "searching fulltext indexes (1.1 and earlier)", :version => '< 1.2.0' do
          include_context "search corpus setup"

          it 'should find document IDs via MapReduce' do
            # Note that the trailing options Hash is ignored when
            # emulating search with MapReduce
            results = @backend.search 'search_test', 'fearless elephant rushed'
            results.should have_key 'docs'
            results.should have_key 'max_score'
            results.should have_key 'num_found'
            results['docs'].should include({"id" => "munchausen-605"})
          end
        end

        if "".respond_to?(:encoding) # Ruby 1.9 and later only
          describe "searching fulltext indexes (1.2 and later)", :version => '>= 1.2.0' do
            include_context "search corpus setup"

            it 'should return documents with UTF-8 fields (GH #75)' do
              utf8 = Encoding.find('UTF-8')
              results = @backend.search 'search_test', 'fearless elephant rushed'
              results['docs'].each do |d|
                d.each {|(k,v)| k.encoding.should == utf8; v.encoding.should == utf8 }
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
riak-client-1.4.5 spec/integration/riak/protobuffs_backends_spec.rb
riak-client-1.4.4.1 spec/integration/riak/protobuffs_backends_spec.rb
riak-client-1.4.4 spec/integration/riak/protobuffs_backends_spec.rb
riak-client-1.4.3 spec/integration/riak/protobuffs_backends_spec.rb
riak-client-1.4.2 spec/integration/riak/protobuffs_backends_spec.rb
riak-client-1.4.1 spec/integration/riak/protobuffs_backends_spec.rb
riak-client-1.4.0 spec/integration/riak/protobuffs_backends_spec.rb
riak-client-1.2.0 spec/integration/riak/protobuffs_backends_spec.rb