Sha256: 33e2855f422e68def91089427e6b93d8efdf9604239dbd494ad048ac7c05fcbe

Contents?: true

Size: 857 Bytes

Versions: 22

Compression:

Stored size: 857 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
      expect(subject.previous_changes).to_not be_empty
      expect(subject.previous_changes.keys).to include("title")
    end
    it "should clean out changes" do
      expect(subject).to_not be_title_changed
      expect(subject.changes).to be_empty
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
active-fedora-8.7.0 spec/integration/attributes_spec.rb
active-fedora-8.6.0 spec/integration/attributes_spec.rb
active-fedora-8.5.0 spec/integration/attributes_spec.rb
active-fedora-8.4.2 spec/integration/attributes_spec.rb
active-fedora-8.4.1 spec/integration/attributes_spec.rb
active-fedora-7.3.1 spec/integration/attributes_spec.rb
active-fedora-7.3.0 spec/integration/attributes_spec.rb
active-fedora-8.4.0 spec/integration/attributes_spec.rb
active-fedora-8.3.0 spec/integration/attributes_spec.rb
active-fedora-8.2.2 spec/integration/attributes_spec.rb
active-fedora-8.2.1 spec/integration/attributes_spec.rb
active-fedora-8.2.0 spec/integration/attributes_spec.rb
active-fedora-7.2.0 spec/integration/attributes_spec.rb
active-fedora-8.1.0 spec/integration/attributes_spec.rb
active-fedora-8.0.1 spec/integration/attributes_spec.rb
active-fedora-8.0.0 spec/integration/attributes_spec.rb
active-fedora-8.0.0.rc3 spec/integration/attributes_spec.rb
active-fedora-8.0.0.rc2 spec/integration/attributes_spec.rb
active-fedora-8.0.0.rc1 spec/integration/attributes_spec.rb
active-fedora-7.1.2 spec/integration/attributes_spec.rb