Sha256: 92f0929c00874521b50ea82e2ef9ff42549d58fb373213d0ac3fce122bfe7165

Contents?: true

Size: 1.67 KB

Versions: 42

Compression:

Stored size: 1.67 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 = ActiveFedora::FileConfigurator.new
    restore_spec_configuration
  end

  it "should initialize from code" do
    YAML.should_receive(:load).never
    File.should_receive(:exists?).never
    File.should_receive(:read).never
    File.should_receive(:open).never
    ActiveFedora.init(@config_params)
    ActiveFedora.fedora_config.credentials.should == @config_params[:fedora_config]
    ActiveFedora.solr_config.should == @config_params[:solr_config]
    ActiveFedora::Predicates.predicate_mappings['info:fedora/fedora-system:def/relations-external#'].length.should == 1
  end
  
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
active-fedora-5.7.1 spec/unit/code_configurator_spec.rb
active-fedora-5.7.0 spec/unit/code_configurator_spec.rb
active-fedora-6.4.0.rc4 spec/unit/code_configurator_spec.rb
active-fedora-6.4.0.rc3 spec/unit/code_configurator_spec.rb
active-fedora-6.4.0.rc2 spec/unit/code_configurator_spec.rb
active-fedora-6.4.0.rc1 spec/unit/code_configurator_spec.rb
active-fedora-6.3.0 spec/unit/code_configurator_spec.rb
active-fedora-6.2.0 spec/unit/code_configurator_spec.rb
active-fedora-6.1.1 spec/unit/code_configurator_spec.rb
active-fedora-6.1.0 spec/unit/code_configurator_spec.rb
active-fedora-5.6.3 spec/unit/code_configurator_spec.rb
active-fedora-6.0.0 spec/unit/code_configurator_spec.rb
active-fedora-6.0.0.rc7 spec/unit/code_configurator_spec.rb
active-fedora-6.0.0.rc6 spec/unit/code_configurator_spec.rb
active-fedora-6.0.0.rc5 spec/unit/code_configurator_spec.rb
active-fedora-6.0.0.rc4 spec/unit/code_configurator_spec.rb
active-fedora-6.0.0.rc3 spec/unit/code_configurator_spec.rb
active-fedora-6.0.0.rc2 spec/unit/code_configurator_spec.rb
active-fedora-6.0.0.rc1 spec/unit/code_configurator_spec.rb
active-fedora-5.6.2 spec/unit/code_configurator_spec.rb