Sha256: 42c2606ec5ec3a1c1bbfecb7b8f76b0ee538de4d2e56c3cbbebe70376e377741
Contents?: true
Size: 866 Bytes
Versions: 2
Compression:
Stored size: 866 Bytes
Contents
require 'spec_helper' describe Spotlight::SolrDocument::AtomicUpdates do let(:blacklight_solr) { double } subject do ::SolrDocument.new.extend(Spotlight::SolrDocument::AtomicUpdates) end before do subject.stub(blacklight_solr: blacklight_solr) end describe "#reindex" do before do subject.stub(to_solr: { id: 'doc_id', a: 1, b: 2 }) end it "should send an atomic update request" do blacklight_solr.should_receive(:update).with(params: { commitWithin: 500 }, data: [{id: 'doc_id', a: { set: 1 }, b: { set: 2 }}].to_json, headers: { 'Content-Type' => 'application/json'}) subject.reindex end it "should cowardly refuse to index a document if the only value is an id" do subject.stub(to_solr: { id: 'doc_id' }) blacklight_solr.should_not_receive(:update) subject.reindex end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
blacklight-spotlight-0.1.0 | spec/models/spotlight/solr_document_atomic_updates_spec.rb |
blacklight-spotlight-0.0.3 | spec/models/spotlight/solr_document_atomic_updates_spec.rb |