Sha256: 7276ce8da2088b36a51bae73f8636fc686bae4eaf51a90faa45cae36cae12db9

Contents?: true

Size: 995 Bytes

Versions: 9

Compression:

Stored size: 995 Bytes

Contents

require 'spec_helper'

require 'active_fedora'
require 'active_fedora/model'
require "rexml/document"

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

9 entries across 9 versions & 1 rubygems

Version Path
active-fedora-9.12.0 spec/integration/bug_spec.rb
active-fedora-9.11.0 spec/integration/bug_spec.rb
active-fedora-9.10.4 spec/integration/bug_spec.rb
active-fedora-9.10.3 spec/integration/bug_spec.rb
active-fedora-9.10.2 spec/integration/bug_spec.rb
active-fedora-9.10.1 spec/integration/bug_spec.rb
active-fedora-9.10.0 spec/integration/bug_spec.rb
active-fedora-9.10.0.pre2 spec/integration/bug_spec.rb
active-fedora-9.10.0.pre1 spec/integration/bug_spec.rb