Sha256: c4c840abccecb1789b2610aa839456a6f85a857fc105137536ae59c0c95a2f2b
Contents?: true
Size: 1.29 KB
Versions: 13
Compression:
Stored size: 1.29 KB
Contents
require 'spec_helper' describe ActiveFedora::SparqlInsert do let(:change_set) { ActiveFedora::ChangeSet.new(base, base.resource, base.changed_attributes.keys) } subject(:sparql_insert) { described_class.new(change_set.changes) } context "with a changed object" do before do class Library < ActiveFedora::Base end class Book < ActiveFedora::Base belongs_to :library, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.hasConstituent property :title, predicate: ::RDF::Vocab::DC.title end base.library_id = 'foo' base.title = ['bar'] end after do Object.send(:remove_const, :Library) Object.send(:remove_const, :Book) end let(:base) { Book.create } it "returns the string" do expect(sparql_insert.build).to eq "DELETE { <> <info:fedora/fedora-system:def/relations-external#hasConstituent> ?change . }\n WHERE { <> <info:fedora/fedora-system:def/relations-external#hasConstituent> ?change . } ;\nDELETE { <> <http://purl.org/dc/terms/title> ?change . }\n WHERE { <> <http://purl.org/dc/terms/title> ?change . } ;\nINSERT { \n<> <info:fedora/fedora-system:def/relations-external#hasConstituent> <#{ActiveFedora.fedora.host}/test/foo> .\n<> <http://purl.org/dc/terms/title> \"bar\" .\n}\n WHERE { }" end end end
Version data entries
13 entries across 13 versions & 1 rubygems