Sha256: d677d1a83fe625adb2a295ee71b17a5e67db4248f47864ddc73108052d39f767

Contents?: true

Size: 711 Bytes

Versions: 14

Compression:

Stored size: 711 Bytes

Contents

require 'spec_helper'

describe "persisting objects" do
  before :all do
    class MockAFBaseRelationship < ActiveFedora::Base
      has_metadata :type=>ActiveFedora::SimpleDatastream, :name=>"foo" do |m|
        m.field "name", :string
      end
      Deprecation.silence(ActiveFedora::Attributes) do
        has_attributes :name, datastream: 'foo', multiple: false
      end
      validates :name, presence: true
    end
  end
  after :all do
    Object.send(:remove_const, :MockAFBaseRelationship)
  end

  describe "#create!" do
    it "should validate" do
      expect { MockAFBaseRelationship.create!}.to raise_error ActiveFedora::RecordInvalid, "Validation failed: Name can't be blank"
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
active-fedora-9.5.0 spec/integration/persistence_spec.rb
active-fedora-9.4.3 spec/integration/persistence_spec.rb
active-fedora-9.4.2 spec/integration/persistence_spec.rb
active-fedora-9.4.1 spec/integration/persistence_spec.rb
active-fedora-9.4.0 spec/integration/persistence_spec.rb
active-fedora-9.3.0 spec/integration/persistence_spec.rb
active-fedora-9.2.1 spec/integration/persistence_spec.rb
active-fedora-9.2.0 spec/integration/persistence_spec.rb
active-fedora-9.2.0.rc2 spec/integration/persistence_spec.rb
active-fedora-9.2.0.rc1 spec/integration/persistence_spec.rb
active-fedora-9.1.2 spec/integration/persistence_spec.rb
active-fedora-9.1.1 spec/integration/persistence_spec.rb
active-fedora-9.1.0 spec/integration/persistence_spec.rb
active-fedora-9.1.0.rc1 spec/integration/persistence_spec.rb