Sha256: 1e0e93df0be3d49e658d9aa00de05717ede5871dd5e98830e18246b2c78a4b2e

Contents?: true

Size: 1.83 KB

Versions: 40

Compression:

Stored size: 1.83 KB

Contents

require 'spec_helper'

describe ActiveFedora::Model do
  
  before(:each) do 
    module ModelIntegrationSpec
      
      class Base < ActiveFedora::Base
        include ActiveFedora::Model
        def self.pid_namespace
          "foo"
        end
      end
      class Basic < Base
      end
    end

    @test_instance = ModelIntegrationSpec::Basic.new
    @test_instance.save
    
  end
  
  after(:each) do
    @test_instance.delete
    Object.send(:remove_const, :ModelIntegrationSpec)
  end
  
  describe '#find' do
    describe "with :all" do
      it "should return an array of instances of the calling Class" do
        result = ModelIntegrationSpec::Basic.find(:all)
        result.should be_instance_of(Array)
        # this test is meaningless if the array length is zero
        result.length.should > 0
        result.each do |obj|
          obj.class.should == ModelIntegrationSpec::Basic
        end
      end
    end
    describe "#find with a valid pid with cast" do
      subject { ActiveFedora::Base.find('hydrangea:fixture_mods_article1', :cast=>true) }
      it { should be_instance_of HydrangeaArticle}
    end
    describe "#find with a valid pid without cast" do
      subject { ActiveFedora::Base.find('hydrangea:fixture_mods_article1') }
      it { should be_instance_of ActiveFedora::Base}
    end
  end

  describe "#load_instance_from_solr" do
    describe "with a valid pid" do
      subject { ActiveFedora::Base.load_instance_from_solr('hydrangea:fixture_mods_article1') }
      it { should be_instance_of HydrangeaArticle}
    end
    describe "with metadata datastrem spec" do
      subject { ActiveFedora::Base.load_instance_from_solr('hydrangea:fixture_mods_article1') }
      it "should create an xml datastream" do
        subject.datastreams['properties'].should be_kind_of ActiveFedora::SimpleDatastream
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
active-fedora-5.7.1 spec/integration/model_spec.rb
active-fedora-5.7.0 spec/integration/model_spec.rb
active-fedora-6.1.0 spec/integration/model_spec.rb
active-fedora-5.6.3 spec/integration/model_spec.rb
active-fedora-6.0.0 spec/integration/model_spec.rb
active-fedora-6.0.0.rc7 spec/integration/model_spec.rb
active-fedora-6.0.0.rc6 spec/integration/model_spec.rb
active-fedora-6.0.0.rc5 spec/integration/model_spec.rb
active-fedora-6.0.0.rc4 spec/integration/model_spec.rb
active-fedora-6.0.0.rc3 spec/integration/model_spec.rb
active-fedora-6.0.0.rc2 spec/integration/model_spec.rb
active-fedora-6.0.0.rc1 spec/integration/model_spec.rb
active-fedora-5.6.2 spec/integration/model_spec.rb
active-fedora-5.6.1 spec/integration/model_spec.rb
active-fedora-6.0.0.pre10 spec/integration/model_spec.rb
active-fedora-6.0.0.pre9 spec/integration/model_spec.rb
active-fedora-5.6.0 spec/integration/model_spec.rb
active-fedora-6.0.0.pre8 spec/integration/model_spec.rb
active-fedora-6.0.0.pre7 spec/integration/model_spec.rb
active-fedora-5.5.2 spec/integration/model_spec.rb