Sha256: 7affb5d35e98e3780cd690d7a000c866cdc2604a94cf5a0ab9d68951c54f603d

Contents?: true

Size: 1.04 KB

Versions: 32

Compression:

Stored size: 1.04 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 { resource.query(predicate: ::RDF::Vocab::DC.extent) }

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

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

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
active-fedora-10.3.0 spec/unit/loadable_from_json_spec.rb
active-fedora-9.7.3 spec/unit/loadable_from_json_spec.rb
active-fedora-10.3.0.rc2 spec/unit/loadable_from_json_spec.rb
active-fedora-10.3.0.rc1 spec/unit/loadable_from_json_spec.rb
active-fedora-10.2.1 spec/unit/loadable_from_json_spec.rb
active-fedora-10.2.0 spec/unit/loadable_from_json_spec.rb
active-fedora-11.0.0.rc1 spec/unit/loadable_from_json_spec.rb
active-fedora-10.1.0 spec/unit/loadable_from_json_spec.rb
active-fedora-10.1.0.rc1 spec/unit/loadable_from_json_spec.rb
active-fedora-9.7.2 spec/unit/loadable_from_json_spec.rb
active-fedora-10.0.0 spec/unit/loadable_from_json_spec.rb
active-fedora-10.0.0.beta4 spec/unit/loadable_from_json_spec.rb
active-fedora-10.0.0.beta3 spec/unit/loadable_from_json_spec.rb
active-fedora-10.0.0.beta2 spec/unit/loadable_from_json_spec.rb
active-fedora-10.0.0.beta1 spec/unit/loadable_from_json_spec.rb
active-fedora-9.13.0 spec/unit/loadable_from_json_spec.rb
active-fedora-9.12.0 spec/unit/loadable_from_json_spec.rb
active-fedora-9.11.0 spec/unit/loadable_from_json_spec.rb
active-fedora-9.10.4 spec/unit/loadable_from_json_spec.rb
active-fedora-9.10.3 spec/unit/loadable_from_json_spec.rb