spec/riak/search/index_spec.rb in riak-client-2.2.0.pre1 vs spec/riak/search/index_spec.rb in riak-client-2.2.0

- old
+ new

@@ -40,19 +40,29 @@ expect(backend).to receive(:get_search_index). with(index_name). and_raise(Riak::ProtobuffsFailedRequest.new(:not_found, 'not found')) expect(backend).to receive(:create_search_index). - with(index_name, nil, nil) + with(index_name, nil, nil, nil) expect{ subject.create! }.to_not raise_error end it 'raises an error when creating an index that already exists' do index_exists_expectation - expect{ subject.create! }.to raise_error(Riak::SearchError::IndexExistsError) + expect{ subject.create! }. + to raise_error(Riak::SearchError::IndexExistsError) end + + it "spawns a query" do + t = "some query term" + expect(subject).to receive(:exists?).and_return(true) + expect(query = subject.query(t)).to be_a Riak::Search::Query + expect(query.term).to eq t + expect(query.index).to eq subject + expect(query.client).to eq subject.client + end it 'returns data about the index' do index_exists_expectation expect(subject.n_val).to eq 3