Sha256: 5425faacb9978104234af9163fd51fc783293ba04cf6bcba5b39640edae6cb44
Contents?: true
Size: 1.35 KB
Versions: 2
Compression:
Stored size: 1.35 KB
Contents
require 'spec_helper' describe ActiveFedora::ChangeSet do let(:change_set) { described_class.new(base, base.resource, base.changed_attributes.keys) } subject { change_set } context "with an unchanged object" do let(:base) { ActiveFedora::Base.new } it { is_expected.to be_empty } end 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::DC.title property :alt_id, predicate: ::RDF::DC.identifier end base.library_id = 'foo' base.title = ['bar'] base.alt_id = ['12345'] end after do Object.send(:remove_const, :Library) Object.send(:remove_const, :Book) end let(:base) { Book.create } describe "#changes" do subject { change_set.changes } it { is_expected.to be_kind_of Hash } it "should have three elements" do expect(subject.size).to eq 3 end it "should not include URIs from other objects" do base.resource << RDF::Statement.new(RDF::URI("http://wrong.com"), RDF::DC.title, "bad") base.title = nil expect(subject[RDF::DC.title].to_a).to eq [] end end it { is_expected.to_not be_empty } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active-fedora-9.3.0 | spec/unit/change_set_spec.rb |
active-fedora-9.2.1 | spec/unit/change_set_spec.rb |