spec/integration/riak/http_backends_spec.rb in riak-client-1.0.5 vs spec/integration/riak/http_backends_spec.rb in riak-client-1.1.0

- old
+ new

@@ -1,10 +1,10 @@ require 'spec_helper' describe "HTTP" do before do - @web_port = $test_server.http_port + @web_port = test_server.http_port @client = Riak::Client.new(:http_port => @web_port) end [:ExconBackend, :NetHTTPBackend].each do |klass| bklass = Riak::Client.const_get(klass) @@ -14,10 +14,31 @@ @backend = bklass.new(@client, @client.node) end it_should_behave_like "Unified backend API" - describe "using Luwak", :version => "0.14.0".."1.0.3" do + describe "searching fulltext indexes (1.1 and earlier)", :version => "< 1.2.0" do + include_context "search corpus setup" + + it 'should find indexed documents, returning ids' do + results = @backend.search 'search_test', 'fearless elephant rushed', :fl => 'id' + 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 + + it 'should find indexed documents, returning documents' do + # For now use '*' until #122 is merged into riak_search + results = @backend.search 'search_test', 'fearless elephant rushed', :fl => '*' + results.should have_key 'docs' + results.should have_key 'max_score' + results.should have_key 'num_found' + results['docs'].should include({"id" => "munchausen-605", "value" => "Fearless I advanced against the elephant, desirous to take alive the haughty Tippoo Sahib; but he drew a pistol from his belt, and discharged it full in my face as I rushed upon him, which did me no further harm than wound my cheek-bone, which disfigures me somewhat under my left eye. I could not withstand the rage and impulse of that moment, and with one blow of my sword separated his head from his body.\n"}) + end + end + + context "using Luwak", :version => "< 1.1.0" do let(:file) { File.open(__FILE__) } let(:key) { "spec.rb" } let(:string) { file.read } def retry_400