Sha256: a2c7147f8e360a7cb9c3d7b063c48b2446c061a2f231009cdaae1b582e53eed2

Contents?: true

Size: 1.35 KB

Versions: 11

Compression:

Stored size: 1.35 KB

Contents

require File.join( File.dirname(__FILE__), "..", "spec_helper" )

require 'active_fedora'
require 'active_fedora/model'
require "rexml/document"
require 'ftools'
require 'mocha'

include ActiveFedora::Model
include Mocha::API

describe ActiveFedora::Model do
  
  
  before(:each) do 
    module ModelIntegrationSpec
      
      class Basic < ActiveFedora::Base
        include ActiveFedora::Model
      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
    it "should return an array of instances of the calling Class" do
      pending
      result = ModelIntegrationSpec::Basic.find(:all)
      result.should be_instance_of(Array)
      result.each do |obj|
        obj.class.should == ModelIntegrationSpec::Basic
      end
    end
  end
  
  describe '#find_model' do
    
    it "should return an object of the given Model whose inner object is nil" do
      #result = ModelIntegrationSpec::Basic.find_model(@test_instance.pid, ModelIntegrationSpec::Basic)
      result = Fedora::Repository.instance.find_model(@test_instance.pid, ModelIntegrationSpec::Basic)
      result.class.should == ModelIntegrationSpec::Basic
      result.inner_object.new_object?.should be_false
    end
  end
  
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
active-fedora-3.0.7 spec/integration/model_spec.rb
active-fedora-3.0.6 spec/integration/model_spec.rb
active-fedora-3.0.5 spec/integration/model_spec.rb
active-fedora-2.3.8 spec/integration/model_spec.rb
active-fedora-3.0.4 spec/integration/model_spec.rb
active-fedora-3.0.3 spec/integration/model_spec.rb
active-fedora-3.0.1 spec/integration/model_spec.rb
active-fedora-3.0.0 spec/integration/model_spec.rb
active-fedora-2.3.7 spec/integration/model_spec.rb
active-fedora-2.3.4 spec/integration/model_spec.rb
active-fedora-2.3.3 spec/integration/model_spec.rb