Sha256: 53d94d17c38a589b2c4dda6d4f5970ee25ea4044e429fa7ae5e767060f1d2c94

Contents?: true

Size: 1023 Bytes

Versions: 11

Compression:

Stored size: 1023 Bytes

Contents

require 'spec_helper'

require 'active_fedora'
require 'active_fedora/model'
require "rexml/document"
include ActiveFedora::Model

describe 'bugs' do
  before do
    class FooHistory < ActiveFedora::Base
      has_metadata type: ActiveFedora::SimpleDatastream, name: "someData" do |m|
        m.field "fubar", :string
      end
    end
    @test_object = FooHistory.new
    @test_object.save
  end
  after do
    @test_object.delete
    Object.send(:remove_const, :FooHistory)
  end

  it 'raises ActiveFedora::ObjectNotFoundError when find("")' do
    expect {
      FooHistory.find('')
    }.to raise_error(ActiveFedora::ObjectNotFoundError)
  end

  it "does not clobber everything when setting a value" do
    @test_object.someData.fubar = ['initial']
    @test_object.save!

    x = FooHistory.find(@test_object.id)
    x.someData.fubar = ["replacement"] # set a new value
    x.save!

    x = FooHistory.find(@test_object.id)
    expect(x.someData.fubar).to eq ["replacement"] # recall the value
    x.save
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
active-fedora-9.7.3 spec/integration/bug_spec.rb
active-fedora-9.7.2 spec/integration/bug_spec.rb
active-fedora-9.9.1 spec/integration/bug_spec.rb
active-fedora-9.9.0 spec/integration/bug_spec.rb
active-fedora-9.8.2 spec/integration/bug_spec.rb
active-fedora-9.8.1 spec/integration/bug_spec.rb
active-fedora-9.8.0 spec/integration/bug_spec.rb
active-fedora-9.7.1 spec/integration/bug_spec.rb
active-fedora-9.7.0 spec/integration/bug_spec.rb
active-fedora-9.6.2 spec/integration/bug_spec.rb
active-fedora-9.6.1 spec/integration/bug_spec.rb