Sha256: f3592fd9b04b57039ac1fc3bc056d72ee5bdb7a41dba2b100b5db30a80ce8f92

Contents?: true

Size: 844 Bytes

Versions: 21

Compression:

Stored size: 844 Bytes

Contents

require 'spec_helper'

describe "delegating attributes" do
  before :all do
    class TitledObject < ActiveFedora::Base
      has_metadata 'foo', type: ActiveFedora::SimpleDatastream do |m|
        m.field "title", :string
      end
      has_attributes :title, datastream: 'foo', multiple: false
    end
  end
  after :all do
    Object.send(:remove_const, :TitledObject)
  end

  describe "save" do
    subject do
      obj = TitledObject.create 
      obj.title = "Hydra for Dummies"
      obj.save
      obj
    end
    it "should keep a list of changes after a successful save" do
      subject.previous_changes.should_not be_empty
      subject.previous_changes.keys.should include("title")
    end
    it "should clean out changes" do
      subject.title_changed?.should be_false
      subject.changes.should be_empty
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
active-fedora-6.7.8 spec/integration/attributes_spec.rb
active-fedora-7.0.4 spec/integration/attributes_spec.rb
active-fedora-7.0.3 spec/integration/attributes_spec.rb
active-fedora-7.0.2 spec/integration/attributes_spec.rb
active-fedora-7.0.1 spec/integration/attributes_spec.rb
active-fedora-7.0.0 spec/integration/attributes_spec.rb
active-fedora-7.0.0.rc3 spec/integration/attributes_spec.rb
active-fedora-6.7.7 spec/integration/attributes_spec.rb
active-fedora-7.0.0.rc2 spec/integration/attributes_spec.rb
active-fedora-6.7.6 spec/integration/attributes_spec.rb
active-fedora-7.0.0.rc1 spec/integration/attributes_spec.rb
active-fedora-6.7.5 spec/integration/attributes_spec.rb
active-fedora-7.0.0.pre3 spec/integration/attributes_spec.rb
active-fedora-6.7.4 spec/integration/attributes_spec.rb
active-fedora-7.0.0.pre2 spec/integration/attributes_spec.rb
active-fedora-7.0.0.pre1 spec/integration/attributes_spec.rb
active-fedora-6.7.3 spec/integration/attributes_spec.rb
active-fedora-6.7.2 spec/integration/attributes_spec.rb
active-fedora-6.7.1 spec/integration/attributes_spec.rb
active-fedora-6.7.0 spec/integration/attributes_spec.rb