Sha256: 868af0b41a00601413f095c0205e4dbe6b341e8e003566ec117ec588f830e500

Contents?: true

Size: 1.24 KB

Versions: 3

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'

RSpec.describe CurationConcerns::GraphExporter do
  let(:work) { create(:work_with_one_file, visibility: 'open') }
  let(:document) { double(id: work.id) }
  let(:request) { double(host: 'localhost') }
  let(:service) { described_class.new(document, request) }

  describe "fetch" do
    subject { service.fetch }
    let(:ttl) { subject.dump(:ntriples) }
    it "transforms suburis to hashcodes" do
      expect(ttl).to match %r{<http://localhost/concern/generic_works/#{work.id}> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://projecthydra.org/works/models#Work>}
      expect(ttl).to match %r{<http://purl\.org/dc/terms/title> "Test title"}
      expect(ttl).to match %r{<http://www\.w3\.org/ns/auth/acl#accessControl> <http://localhost/catalog/}

      query = subject.query([RDF::URI("http://localhost/concern/generic_works/#{work.id}"),
                             RDF::URI("http://www.iana.org/assignments/relation/first"),
                             nil])
      proxy = query.to_a.first.object

      expect(proxy.to_s).to match %r{http://localhost/concern/generic_works/#{work.id}/list_source#g\d+}

      # It includes the list nodes on the graph
      expect(subject.query([proxy, nil, nil]).count).to eq 2
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
curation_concerns-2.0.0 spec/services/graph_exporter_spec.rb
curation_concerns-2.0.0.rc2 spec/services/graph_exporter_spec.rb
curation_concerns-2.0.0.rc1 spec/services/graph_exporter_spec.rb