Sha256: ca5a9afec0c3acc8dfcb66a61f6c11b76f986e55b25662ebae65209e942f9d87

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

describe FedoraMigrate::TargetConstructor do

  context "with one qualified model" do
    let(:list) { ["info:fedora/fedora-system:FedoraObject-3.0", "info:fedora/afmodel:String"] }
    subject { FedoraMigrate::TargetConstructor.new(list).build }
    it "should choose the one that is valid" do
      expect(subject.target).to eql String
    end
  end

  context "with multiple qualified models" do
    let(:list) { ["info:fedora/fedora-system:FedoraObject-3.0", "info:fedora/afmodel:Array", "info:fedora/afmodel:String"] }
    subject { FedoraMigrate::TargetConstructor.new(list).build }
    it "should choose the first one that is valid" do
      expect(subject.target).to eql Array
    end
  end

  context "with a single qualified model" do
    subject { FedoraMigrate::TargetConstructor.new("info:fedora/afmodel:Array").build }
    it "should be valid" do
      expect(subject.target).to eql Array
    end
  end

  context "with multiple unqualified models" do
    let(:list) { ["info:fedora/fedora-system:FedoraObject-3.0", "info:fedora/fedora-system:FooObject"] }
    subject { FedoraMigrate::TargetConstructor.new(list).build.target }
    it { is_expected.to be_nil }
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fedora-migrate-0.3.0 spec/unit/target_constructor_spec.rb
fedora-migrate-0.2.0 spec/unit/target_constructor_spec.rb
fedora-migrate-0.1.0 spec/unit/target_constructor_spec.rb