Sha256: 7a34738676705e6659eb676f06877a557cdc3abe484036cd94ea18c0be91f921

Contents?: true

Size: 1022 Bytes

Versions: 20

Compression:

Stored size: 1022 Bytes

Contents

require 'spec_helper'

describe ActiveFedora::Base do
  before do
    class Foo < ActiveFedora::Base
      has_metadata "foostream", type: ActiveFedora::SimpleDatastream do |m|
        m.field "foostream", :string
      end
      has_metadata 'dcstream', type: ActiveFedora::QualifiedDublinCoreDatastream
    end
    class Bar < ActiveFedora::Base
      has_metadata 'barstream', type: ActiveFedora::SimpleDatastream do |m|
        m.field "barfield", :string
      end
    end
  end

  it "doesn't overwrite stream specs" do
    f = Foo.new
    expect(f.attached_files.size).to eq 2
    streams = f.attached_files.values.map { |x| x.class.to_s }.sort
    expect(streams.pop).to eq "ActiveFedora::SimpleDatastream"
    expect(streams.pop).to eq "ActiveFedora::QualifiedDublinCoreDatastream"
  end

  it "works for multiple types" do
    b = Foo.new
    f = Bar.new
    expect(b.class.ds_specs).to_not eq f.class.ds_specs
  end
  after do
    Object.send(:remove_const, :Bar)
    Object.send(:remove_const, :Foo)
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
active-fedora-9.7.3 spec/unit/inheritance_spec.rb
active-fedora-9.7.2 spec/unit/inheritance_spec.rb
active-fedora-9.12.0 spec/unit/inheritance_spec.rb
active-fedora-9.11.0 spec/unit/inheritance_spec.rb
active-fedora-9.10.4 spec/unit/inheritance_spec.rb
active-fedora-9.10.3 spec/unit/inheritance_spec.rb
active-fedora-9.10.2 spec/unit/inheritance_spec.rb
active-fedora-9.10.1 spec/unit/inheritance_spec.rb
active-fedora-9.10.0 spec/unit/inheritance_spec.rb
active-fedora-9.10.0.pre2 spec/unit/inheritance_spec.rb
active-fedora-9.10.0.pre1 spec/unit/inheritance_spec.rb
active-fedora-9.9.1 spec/unit/inheritance_spec.rb
active-fedora-9.9.0 spec/unit/inheritance_spec.rb
active-fedora-9.8.2 spec/unit/inheritance_spec.rb
active-fedora-9.8.1 spec/unit/inheritance_spec.rb
active-fedora-9.8.0 spec/unit/inheritance_spec.rb
active-fedora-9.7.1 spec/unit/inheritance_spec.rb
active-fedora-9.7.0 spec/unit/inheritance_spec.rb
active-fedora-9.6.2 spec/unit/inheritance_spec.rb
active-fedora-9.6.1 spec/unit/inheritance_spec.rb