Sha256: 68104f26e62e3b2b9c4f514ea482b6b04f4abac19f495b9398fb38fe7e477f79

Contents?: true

Size: 1.26 KB

Versions: 41

Compression:

Stored size: 1.26 KB

Contents

require 'spec_helper'

RSpec.describe ActiveFedora::Indexers::GlobalIndexer do
  let(:global_indexer) { described_class.new(index_types) }
  let(:index_types) {}

  describe "#new" do
    # The global indexer acts as both an indexer factory and an indexer, since
    # the property doesn't matter.
    it "returns itself" do
      expect(global_indexer.new("bla")).to eq global_indexer
    end
  end
  describe "#index" do
    let(:index_obj) { instance_double(ActiveFedora::Indexing::Map::IndexObject, as: nil) }
    context "with one index type" do
      let(:index_types) { :symbol }
      it "passes that to index_obj" do
        global_indexer.index(index_obj)

        expect(index_obj).to have_received(:as).with(:symbol)
      end
    end
    context "with multiple index types" do
      let(:index_types) { [:symbol, :stored_searchable] }
      it "passes that to index_obj" do
        global_indexer.index(index_obj)

        expect(index_obj).to have_received(:as).with(:symbol, :stored_searchable)
      end
    end
    context "with no index types" do
      let(:global_indexer) { described_class.new }
      it "does not pass anything to index_obj" do
        global_indexer.index(index_obj)

        expect(index_obj).not_to have_received(:as)
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
active-fedora-12.2.4 spec/unit/indexers/global_indexer_spec.rb
active-fedora-12.2.3 spec/unit/indexers/global_indexer_spec.rb
active-fedora-11.5.6 spec/unit/indexers/global_indexer_spec.rb
active-fedora-12.2.2 spec/unit/indexers/global_indexer_spec.rb
active-fedora-11.2.1 spec/unit/indexers/global_indexer_spec.rb
active-fedora-12.2.1 spec/unit/indexers/global_indexer_spec.rb
active-fedora-12.0.3 spec/unit/indexers/global_indexer_spec.rb
active-fedora-11.5.5 spec/unit/indexers/global_indexer_spec.rb
active-fedora-13.1.2 spec/unit/indexers/global_indexer_spec.rb
active-fedora-13.1.1 spec/unit/indexers/global_indexer_spec.rb
active-fedora-13.1.0 spec/unit/indexers/global_indexer_spec.rb
active-fedora-13.0.0 spec/unit/indexers/global_indexer_spec.rb
active-fedora-12.1.1 spec/unit/indexers/global_indexer_spec.rb
active-fedora-12.1.0 spec/unit/indexers/global_indexer_spec.rb
active-fedora-11.5.4 spec/unit/indexers/global_indexer_spec.rb
active-fedora-11.5.3 spec/unit/indexers/global_indexer_spec.rb
active-fedora-12.0.2 spec/unit/indexers/global_indexer_spec.rb
active-fedora-12.0.1 spec/unit/indexers/global_indexer_spec.rb
active-fedora-11.5.2 spec/unit/indexers/global_indexer_spec.rb
active-fedora-12.0.0 spec/unit/indexers/global_indexer_spec.rb