Sha256: 9d739b0096299d351521af9cac8ebbb3be06fbebee8c1aeb0e30a2be4ed7da4d

Contents?: true

Size: 1021 Bytes

Versions: 55

Compression:

Stored size: 1021 Bytes

Contents

require 'spec_helper'

RSpec.describe ActiveFedora::Base do
  before do
    class Source < ActiveFedora::Base
      has_subresource :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

55 entries across 55 versions & 1 rubygems

Version Path
active-fedora-12.2.4 spec/integration/has_subresource_spec.rb
active-fedora-12.2.3 spec/integration/has_subresource_spec.rb
active-fedora-11.5.6 spec/integration/has_subresource_spec.rb
active-fedora-12.2.2 spec/integration/has_subresource_spec.rb
active-fedora-11.2.1 spec/integration/has_subresource_spec.rb
active-fedora-12.2.1 spec/integration/has_subresource_spec.rb
active-fedora-12.0.3 spec/integration/has_subresource_spec.rb
active-fedora-11.5.5 spec/integration/has_subresource_spec.rb
active-fedora-13.1.2 spec/integration/has_subresource_spec.rb
active-fedora-13.1.1 spec/integration/has_subresource_spec.rb
active-fedora-13.1.0 spec/integration/has_subresource_spec.rb
active-fedora-13.0.0 spec/integration/has_subresource_spec.rb
active-fedora-12.1.1 spec/integration/has_subresource_spec.rb
active-fedora-12.1.0 spec/integration/has_subresource_spec.rb
active-fedora-11.5.4 spec/integration/has_subresource_spec.rb
active-fedora-11.5.3 spec/integration/has_subresource_spec.rb
active-fedora-12.0.2 spec/integration/has_subresource_spec.rb
active-fedora-12.0.1 spec/integration/has_subresource_spec.rb
active-fedora-11.5.2 spec/integration/has_subresource_spec.rb
active-fedora-12.0.0 spec/integration/has_subresource_spec.rb