Sha256: 936f91b72fb65852a2ecb7d814433d9cdea2c7f943b37edf4e47325ba45fc83c

Contents?: true

Size: 1.63 KB

Versions: 21

Compression:

Stored size: 1.63 KB

Contents

require 'spec_helper'
require 'config_helper'

describe ActiveFedora::FileConfigurator do
  before :all do
    class TestConfigurator
      attr_reader :fedora_config, :solr_config, :predicate_config

      def init(options = {})
        @fedora_config = options[:fedora_config]
        @solr_config = options[:solr_config]
        @predicate_config = options[:predicate_config]
      end
    end

    @config_params = {
      fedora_config: { url: 'http://codeconfig.example.edu/fedora/', user: 'fedoraAdmin', password: 'configurator', cert_file: '/path/to/cert/file' },
      solr_config: { url: 'http://codeconfig.example.edu/solr/' },
      predicate_config: {
        default_namespace: 'info:fedora/fedora-system:def/relations-external#',
        predicate_mapping: {
          'info:fedora/fedora-system:def/relations-external#' => { has_part: 'hasPart' }
        }
      }
    }
  end

  before :each do
    ActiveFedora.configurator = TestConfigurator.new
  end

  after :all do
    unstub_rails
    # Restore to default fedora configs
    ActiveFedora.configurator = described_class.new
    restore_spec_configuration
  end

  it "initializes from code" do
    expect(Psych).to receive(:load).never
    expect(File).to receive(:exists?).never
    expect(File).to receive(:read).never
    expect(File).to receive(:open).never
    ActiveFedora.init(@config_params)
    expect(ActiveFedora.fedora_config.credentials).to eq @config_params[:fedora_config]
    expect(ActiveFedora.solr_config).to eq @config_params[:solr_config]
    expect(ActiveFedora::Predicates.predicate_mappings['info:fedora/fedora-system:def/relations-external#'].length).to eq 1
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
active-fedora-9.7.3 spec/unit/code_configurator_spec.rb
active-fedora-9.7.2 spec/unit/code_configurator_spec.rb
active-fedora-9.13.0 spec/unit/code_configurator_spec.rb
active-fedora-9.12.0 spec/unit/code_configurator_spec.rb
active-fedora-9.11.0 spec/unit/code_configurator_spec.rb
active-fedora-9.10.4 spec/unit/code_configurator_spec.rb
active-fedora-9.10.3 spec/unit/code_configurator_spec.rb
active-fedora-9.10.2 spec/unit/code_configurator_spec.rb
active-fedora-9.10.1 spec/unit/code_configurator_spec.rb
active-fedora-9.10.0 spec/unit/code_configurator_spec.rb
active-fedora-9.10.0.pre2 spec/unit/code_configurator_spec.rb
active-fedora-9.10.0.pre1 spec/unit/code_configurator_spec.rb
active-fedora-9.9.1 spec/unit/code_configurator_spec.rb
active-fedora-9.9.0 spec/unit/code_configurator_spec.rb
active-fedora-9.8.2 spec/unit/code_configurator_spec.rb
active-fedora-9.8.1 spec/unit/code_configurator_spec.rb
active-fedora-9.8.0 spec/unit/code_configurator_spec.rb
active-fedora-9.7.1 spec/unit/code_configurator_spec.rb
active-fedora-9.7.0 spec/unit/code_configurator_spec.rb
active-fedora-9.6.2 spec/unit/code_configurator_spec.rb