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