Sha256: 63a60f6092ddfe036744591e5db0b8e613dd005c1d66538fa93190502da54c5e

Contents?: true

Size: 1.66 KB

Versions: 11

Compression:

Stored size: 1.66 KB

Contents

require File.join( File.dirname(__FILE__), "..", "spec_helper" )

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

include ActiveFedora::Model
include Mocha::API

describe 'bugs' do
class FooHistory < ActiveFedora::Base
  has_metadata :type=>ActiveFedora::MetadataDatastream, :name=>"someData" do |m|
    m.field "fubar", :string
    m.field "swank", :text
  end
  has_metadata :type=>ActiveFedora::MetadataDatastream, :name=>"withText" do |m|
    m.field "fubar", :text
  end
end

  before(:each) do
    #Fedora::Repository.instance.stubs(:nextid).returns("foo:pid")
    @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
    @test_object.datastreams["someData"].fubar_values.should == []
    @test_object.datastreams["someData"].should_not be_nil
    @test_object.datastreams["someData"].fubar_values=['bar']
    @test_object.datastreams["someData"].fubar_values.should == ['bar']
    @test_object.save

    @test_object.pid.should_not be_nil

    x = *FooHistory.find(@test_object.pid)
    x.datastreams["someData"].fubar_values.should == ['bar']
    x.datastreams['someData'].dirty?.should == false
    x.datastreams['someData'].fubar_values = ["meh"]
    x.datastreams['someData'].fubar_values.should == ["meh"]
    x.datastreams['someData'].dirty?.should == true
    x.save
    x = *FooHistory.find(@test_object.pid)
    x.datastreams['someData'].fubar_values.should == ["meh"]
    x.save
  end
  it "should update the index, even if there is no metadata" do
    pending
    oh = FooHistory.new
    oh.save
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
active-fedora-3.0.7 spec/integration/bug_spec.rb
active-fedora-3.0.6 spec/integration/bug_spec.rb
active-fedora-3.0.5 spec/integration/bug_spec.rb
active-fedora-2.3.8 spec/integration/bug_spec.rb
active-fedora-3.0.4 spec/integration/bug_spec.rb
active-fedora-3.0.3 spec/integration/bug_spec.rb
active-fedora-3.0.1 spec/integration/bug_spec.rb
active-fedora-3.0.0 spec/integration/bug_spec.rb
active-fedora-2.3.7 spec/integration/bug_spec.rb
active-fedora-2.3.4 spec/integration/bug_spec.rb
active-fedora-2.3.3 spec/integration/bug_spec.rb