Sha256: ce249d12b6b8b3418f091d3fc65015b60c0c286cff033f7cfd0b046ddd6b1550

Contents?: true

Size: 796 Bytes

Versions: 41

Compression:

Stored size: 796 Bytes

Contents

require 'spec_helper'

describe ActiveFedora::IndexingService do
  let(:indexer) { described_class.new(object) }
  let(:object) { ActiveFedora::Base.new }

  describe "#generate_solr_document" do
    context "when no block is passed" do
      subject(:solr_doc) { indexer.generate_solr_document }
      it "produces a document" do
        expect(solr_doc['has_model_ssim']).to eq ['ActiveFedora::Base']
      end
    end

    context "when a block is passed" do
      subject(:solr_doc) do
        indexer.generate_solr_document do |solr_doc|
          solr_doc['noid'] = '12345'
        end
      end

      it "produces and yield the document" do
        expect(solr_doc['has_model_ssim']).to eq ['ActiveFedora::Base']
        expect(solr_doc['noid']).to eq '12345'
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
active-fedora-11.0.0.rc2 spec/unit/indexing_service_spec.rb