Sha256: e2809c0e16e8a1281759faab149d02da4552f694c29a7204b83d869a86c64702

Contents?: true

Size: 1.21 KB

Versions: 10

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

RSpec.describe ActiveFedora::Indexers::GlobalIndexer do
  subject { 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 "should return itself" do
      expect(subject.new("bla")).to eq subject
    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 "should pass that to index_obj" do
        subject.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 "should pass that to index_obj" do
        subject.index(index_obj)

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

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
active-fedora-9.5.0 spec/unit/indexers/global_indexer_spec.rb
active-fedora-9.4.3 spec/unit/indexers/global_indexer_spec.rb
active-fedora-9.4.2 spec/unit/indexers/global_indexer_spec.rb
active-fedora-9.4.1 spec/unit/indexers/global_indexer_spec.rb
active-fedora-9.4.0 spec/unit/indexers/global_indexer_spec.rb
active-fedora-9.3.0 spec/unit/indexers/global_indexer_spec.rb
active-fedora-9.2.1 spec/unit/indexers/global_indexer_spec.rb
active-fedora-9.2.0 spec/unit/indexers/global_indexer_spec.rb
active-fedora-9.2.0.rc2 spec/unit/indexers/global_indexer_spec.rb
active-fedora-9.2.0.rc1 spec/unit/indexers/global_indexer_spec.rb