Sha256: eea9bcf0982d068f444e021a51bff55b454413461dbc8acd159a9cda56dd0243

Contents?: true

Size: 1.38 KB

Versions: 23

Compression:

Stored size: 1.38 KB

Contents

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

require 'active_fedora'
require 'active_fedora/base'
require 'active_fedora/metadata_datastream'
require 'active_fedora/qualified_dublin_core_datastream'

describe ActiveFedora::Base do
  before(:each) do
    #Fedora::Repository.instance.stubs(:nextid).returns("_nextid_")
    class Foo < ActiveFedora::Base
      has_metadata :type=>ActiveFedora::MetadataDatastream, :name=>"foostream" do|m|
        m.field "foostream", :string
      end
      has_metadata :type=>ActiveFedora::QualifiedDublinCoreDatastream, :name=>"dcstream" do|m|
        m.field "fz", :string
      end
    end
    class Bar  < ActiveFedora::Base
      has_metadata :type=>ActiveFedora::MetadataDatastream, :name=>"barstream" do |m|
        m.field "barfield", :string
      end
    end
  end

  it "doesn't overwrite stream specs" do
    f = Foo.new
    f.datastreams.size.should == 3
    streams = f.datastreams.values.map{|x| x.class.to_s}.sort
    streams.pop.should == "ActiveFedora::RelsExtDatastream"
    streams.pop.should == "ActiveFedora::QualifiedDublinCoreDatastream"
    streams.pop.should == "ActiveFedora::MetadataDatastream"
  end

  it "should work for multiple types" do
    b = Foo.new
    f = Bar.new
    b.class.ds_specs.should_not == f.class.ds_specs
  end
  after do
    Object.send(:remove_const, :Bar)
    Object.send(:remove_const, :Foo)
  end

end
  

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
active-fedora-3.1.4 spec/unit/inheritance_spec.rb
active-fedora-3.1.3 spec/unit/inheritance_spec.rb
active-fedora-3.1.2 spec/unit/inheritance_spec.rb
active-fedora-3.1.1 spec/unit/inheritance_spec.rb
active-fedora-3.1.0 spec/unit/inheritance_spec.rb
active-fedora-3.1.0.rc4 spec/unit/inheritance_spec.rb
active-fedora-3.1.0.rc3 spec/unit/inheritance_spec.rb
active-fedora-3.1.0.rc2 spec/unit/inheritance_spec.rb
active-fedora-3.1.0.rc1 spec/unit/inheritance_spec.rb
active-fedora-3.1.0.pre14 spec/unit/inheritance_spec.rb
active-fedora-3.1.0.pre13 spec/unit/inheritance_spec.rb
active-fedora-3.1.0.pre12 spec/unit/inheritance_spec.rb
active-fedora-3.1.0.pre11 spec/unit/inheritance_spec.rb
active-fedora-3.1.0.pre10 spec/unit/inheritance_spec.rb
active-fedora-3.1.0.pre9 spec/unit/inheritance_spec.rb
active-fedora-3.1.0.pre8 spec/unit/inheritance_spec.rb
active-fedora-3.1.0.pre7 spec/unit/inheritance_spec.rb
active-fedora-3.1.0.pre6 spec/unit/inheritance_spec.rb
active-fedora-3.1.0.pre5 spec/unit/inheritance_spec.rb
active-fedora-3.1.0.pre4 spec/unit/inheritance_spec.rb