Sha256: ee5c8cd7591c1de13cdd78e1ea2c1d0a28c2ce1ddf97bf27c224e624769796bd

Contents?: true

Size: 1.59 KB

Versions: 3

Compression:

Stored size: 1.59 KB

Contents

require File.join( File.dirname(__FILE__),  "../spec_helper" )
require 'active_fedora/rubydora_connection'

describe ActiveFedora::RubydoraConnection do

  describe 'nextid' do
    before do
      @instance = ActiveFedora::RubydoraConnection.instance
    end
    it "should get nextid" do
      one = @instance.nextid
      two = @instance.nextid
      one = one.gsub('changeme:', '').to_i
      two = two.gsub('changeme:', '').to_i
      two.should == one + 1
    end
  end

  describe 'connect' do
    before do
      @instance = ActiveFedora::RubydoraConnection.instance
      @reconfig = { :force => true, :url => @instance.connection.client.url }.merge(@instance.connection.client.options)
    end
    
    after do
      ActiveFedora::RubydoraConnection.connect @reconfig
    end
    
    it "shouldn't reconnect by default" do
      client_id = @instance.connection.client.object_id
      ActiveFedora::RubydoraConnection.connect :timeout => 3600
      @instance.connection.client.object_id.should == client_id
    end
    
    it "should reconnect with force" do
      client_id = @instance.connection.client.object_id
      ActiveFedora::RubydoraConnection.connect :force => true
      @instance.connection.client.object_id.should_not == client_id
    end
    
    it "should pass through valid options" do
      ActiveFedora::RubydoraConnection.connect :timeout => 3600, :fake_option => :missing, :force => true
      @instance.connection.client.options[:timeout].should == 3600
      @instance.connection.client.options.has_key?(:fake_option).should be_false
    end
  end

  describe 'find_model' do
    
  end

  
end


Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
active-fedora-3.1.4 spec/unit/rubydora_connection_spec.rb
active-fedora-3.1.3 spec/unit/rubydora_connection_spec.rb
active-fedora-3.1.2 spec/unit/rubydora_connection_spec.rb