Sha256: 2579224d7e5d06e210d4fe0fcec29a7ddc1d04219c31b5e4804cc883a9cadd24

Contents?: true

Size: 1.24 KB

Versions: 31

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'

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

describe 'bugs' do
  before :all do
    class FooHistory < ActiveFedora::Base
      has_metadata :type=>ActiveFedora::SimpleDatastream, :name=>"someData" do |m|
        m.field "fubar", :string
        m.field "swank", :text
      end
      has_metadata :type=>ActiveFedora::SimpleDatastream, :name=>"withText" do |m|
        m.field "fubar", :text
      end
    end
  end
  after :all do
    Object.send(:remove_const, :FooHistory)
  end

  before(:each) do
    @test_object = FooHistory.new
    @test_object.save
  end
  after(:each) do
    @test_object.delete
  end
  it "should not clobber everything when setting a value" do
    ds = @test_object.datastreams["someData"]
    ds.fubar.should == []
    ds.should_not be_nil
    ds.fubar=['bar']
    ds.fubar.should == ['bar']
    @test_object.save

    @test_object.pid.should_not be_nil

    x = FooHistory.find(@test_object.pid)
    ds2 = x.datastreams["someData"]
    ds2.fubar.should == ['bar']
    ds2.fubar = ["meh"]
    ds2.fubar.should == ["meh"]
    x.save
    x = FooHistory.find(@test_object.pid)
    x.datastreams['someData'].fubar.should == ["meh"]
    x.save
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
active-fedora-5.7.1 spec/integration/bug_spec.rb
active-fedora-5.7.0 spec/integration/bug_spec.rb
active-fedora-5.6.3 spec/integration/bug_spec.rb
active-fedora-6.0.0.rc5 spec/integration/bug_spec.rb
active-fedora-6.0.0.rc4 spec/integration/bug_spec.rb
active-fedora-6.0.0.rc3 spec/integration/bug_spec.rb
active-fedora-6.0.0.rc2 spec/integration/bug_spec.rb
active-fedora-6.0.0.rc1 spec/integration/bug_spec.rb
active-fedora-5.6.2 spec/integration/bug_spec.rb
active-fedora-5.6.1 spec/integration/bug_spec.rb
active-fedora-6.0.0.pre10 spec/integration/bug_spec.rb
active-fedora-6.0.0.pre9 spec/integration/bug_spec.rb
active-fedora-5.6.0 spec/integration/bug_spec.rb
active-fedora-6.0.0.pre8 spec/integration/bug_spec.rb
active-fedora-6.0.0.pre7 spec/integration/bug_spec.rb
active-fedora-5.5.2 spec/integration/bug_spec.rb
active-fedora-6.0.0.pre6 spec/integration/bug_spec.rb
active-fedora-6.0.0.pre5 spec/integration/bug_spec.rb
active-fedora-6.0.0.pre4 spec/integration/bug_spec.rb
active-fedora-6.0.0.pre3 spec/integration/bug_spec.rb