Sha256: 1f314a8e31bf30456be7980762103485bc187f59fceb5dea9a3fd4305c19a51e

Contents?: true

Size: 1.65 KB

Versions: 33

Compression:

Stored size: 1.65 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.expects(:load).never
    File.expects(:exists?).never
    File.expects(:read).never
    File.expects(: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

33 entries across 33 versions & 1 rubygems

Version Path
active-fedora-5.1.0 spec/unit/code_configurator_spec.rb
active-fedora-5.0.0 spec/unit/code_configurator_spec.rb
active-fedora-5.0.0.rc5 spec/unit/code_configurator_spec.rb
active-fedora-5.0.0.rc4 spec/unit/code_configurator_spec.rb
active-fedora-5.0.0.rc3 spec/unit/code_configurator_spec.rb
active-fedora-5.0.0.rc2 spec/unit/code_configurator_spec.rb
active-fedora-5.0.0.rc1 spec/unit/code_configurator_spec.rb
active-fedora-4.6.0.rc4 spec/unit/code_configurator_spec.rb
active-fedora-4.6.0.rc3 spec/unit/code_configurator_spec.rb
active-fedora-4.6.0.rc2 spec/unit/code_configurator_spec.rb
active-fedora-4.6.0.rc1 spec/unit/code_configurator_spec.rb
active-fedora-4.5.3 spec/unit/code_configurator_spec.rb
active-fedora-4.5.2 spec/unit/code_configurator_spec.rb
active-fedora-4.5.1 spec/unit/code_configurator_spec.rb
active-fedora-4.5.0 spec/unit/code_configurator_spec.rb
active-fedora-4.4.1 spec/unit/code_configurator_spec.rb
active-fedora-4.4.0 spec/unit/code_configurator_spec.rb
active-fedora-4.3.0 spec/unit/code_configurator_spec.rb
active-fedora-4.2.0 spec/unit/code_configurator_spec.rb
active-fedora-4.1.0 spec/unit/code_configurator_spec.rb