Sha256: 7fec5b4d8e995f0ad2c2dec720d826287f0f7f1ce7efb0592e374c62a0d5405a

Contents?: true

Size: 1.06 KB

Versions: 41

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

describe ActiveFedora::LoadableFromJson::SolrBackedResource do
  before do
    class Foo < ActiveFedora::Base
      belongs_to :bar, predicate: ::RDF::Vocab::DC.extent
    end

    class Bar < ActiveFedora::Base
    end
  end

  after do
    Object.send(:remove_const, :Foo)
    Object.send(:remove_const, :Bar)
  end

  let(:resource) { described_class.new(Foo) }

  before do
    resource.insert [nil, ::RDF::Vocab::DC.extent, RDF::URI('http://example.org/123')]
  end

  describe "#query" do
    describe "a known relationship" do
      subject(:resources) { resource.query(predicate: ::RDF::Vocab::DC.extent) }

      it "is enumerable" do
        expect(resources.map(&:object)).to eq [RDF::URI('http://example.org/123')]
      end
    end

    describe "a unknown relationship" do
      subject(:resources) { resource.query(predicate: ::RDF::Vocab::DC.accrualPeriodicity) }
      it "raises an error" do
        expect { resources }.to raise_error "Unable to find reflection for http://purl.org/dc/terms/accrualPeriodicity in Foo"
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

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