Sha256: 12d6a7aceabd1e2a7737372c527e5fe12a6e70783974d22f147ea6b82daa08e5
Contents?: true
Size: 1.12 KB
Versions: 8
Compression:
Stored size: 1.12 KB
Contents
require 'spec_helper' describe "persisting objects" do describe "#create!" do before do class MockAFBaseRelationship < ActiveFedora::Base has_metadata type: ActiveFedora::SimpleDatastream, name: "foo" do |m| m.field "name", :string end property :name, predicate: ::RDF::Vocab::DC.title, multiple: false validates :name, presence: true end end after do Object.send(:remove_const, :MockAFBaseRelationship) end it "validates" do expect { MockAFBaseRelationship.create! }.to raise_error ActiveFedora::RecordInvalid, "Validation failed: Name can't be blank" end end describe "#save" do context "With undefined contains associations" do let(:f1) { ActiveFedora::Base.create } let!(:f2) { ActiveFedora::Base.create(id: "#{f1.id}/part2") } before do f1.reload # so it learns about f2 end it "doesn't load the children" do allow(f1).to receive(:update_index) # solrizing can load the attached files. expect(ActiveFedora::File).not_to receive(:new) f1.save end end end end
Version data entries
8 entries across 8 versions & 1 rubygems