Sha256: dd3c042bef70e193796d60c3cb1eb2352ccd7e7a05e816b2ed5144f275588583

Contents?: true

Size: 1014 Bytes

Versions: 18

Compression:

Stored size: 1014 Bytes

Contents

require 'spec_helper'

RSpec.describe ActiveFedora::Base do
  before do
    class Source < ActiveFedora::Base
      contains :sub_resource, class_name: "Source"
      property :title, predicate: ::RDF::Vocab::DC.title, multiple: false
    end
  end
  after do
    Object.send(:remove_const, :Source)
  end

  describe "contains relationships" do
    it "is able to have RDF sources" do
      s = Source.new
      s.sub_resource.title = "Test"
      expect(s.sub_resource).not_to be_persisted
      expect { s.save }.not_to raise_error
      s.reload
      expect(s.sub_resource.title).to eq "Test"
      expect(s.sub_resource.uri).to eq s.uri.to_s + "/sub_resource"
    end
    it "is able to add RDF sources" do
      s = Source.create
      s.sub_resource.title = "Test"
      expect(s.sub_resource).not_to be_persisted
      expect { s.save }.not_to raise_error
      s.reload
      expect(s.sub_resource.title).to eq "Test"
      expect(s.sub_resource.uri).to eq s.uri.to_s + "/sub_resource"
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

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