Sha256: 1c10077199bce8cd5e1cec8c2a36833dda37cad8be59e9cf3e613fc94cd1ff68

Contents?: true

Size: 648 Bytes

Versions: 25

Compression:

Stored size: 648 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
      has_attributes :name, datastream: 'foo', multiple: false
      validates :name, presence: true
    end
  end
  after :all do
    Object.send(:remove_const, :MockAFBaseRelationship)
  end

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

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
active-fedora-7.3.1 spec/integration/persistence_spec.rb
active-fedora-7.3.0 spec/integration/persistence_spec.rb
active-fedora-8.2.1 spec/integration/persistence_spec.rb
active-fedora-8.2.0 spec/integration/persistence_spec.rb
active-fedora-7.2.0 spec/integration/persistence_spec.rb
active-fedora-8.1.0 spec/integration/persistence_spec.rb
active-fedora-8.0.1 spec/integration/persistence_spec.rb
active-fedora-8.0.0 spec/integration/persistence_spec.rb
active-fedora-8.0.0.rc3 spec/integration/persistence_spec.rb
active-fedora-8.0.0.rc2 spec/integration/persistence_spec.rb
active-fedora-8.0.0.rc1 spec/integration/persistence_spec.rb
active-fedora-7.1.2 spec/integration/persistence_spec.rb
active-fedora-7.1.1 spec/integration/persistence_spec.rb
active-fedora-7.1.0 spec/integration/persistence_spec.rb
active-fedora-7.0.4 spec/integration/persistence_spec.rb
active-fedora-7.0.3 spec/integration/persistence_spec.rb
active-fedora-7.0.2 spec/integration/persistence_spec.rb
active-fedora-7.0.1 spec/integration/persistence_spec.rb
active-fedora-7.0.0 spec/integration/persistence_spec.rb
active-fedora-7.0.0.rc3 spec/integration/persistence_spec.rb