Sha256: 59cff68bc945e3d4c522a3245b89f16dc4b11f3e126971d27195747e2d6efe3f

Contents?: true

Size: 1.26 KB

Versions: 32

Compression:

Stored size: 1.26 KB

Contents

require 'spec_helper'

describe ActiveFedora::Base do
  before :all do
    class CallbackStub < ActiveFedora::Base
      has_metadata :type=>ActiveFedora::MetadataDatastream, :name=>"someData" do |m|
        m.field "fubar", :string
        m.field "swank", :text
      end
      delegate :fubar, :to=>'someData'
      delegate :swank, :to=>'someData'

      after_initialize :a_init
      before_save :b_save
      after_save :a_save
      before_create :b_create
      after_create :a_create
      before_update :b_update
      after_update :a_update
      after_find :a_find
      
    end
  end
  after :all do
    Object.send(:remove_const, :CallbackStub)
  end

  it "Should have after_initialize, before_save,after_save, before_create, after_create, after_update, before_update" do
    CallbackStub.any_instance.expects(:a_init).twice
    CallbackStub.any_instance.expects :b_create
    CallbackStub.any_instance.expects :a_create
    CallbackStub.any_instance.expects(:b_save).twice
    CallbackStub.any_instance.expects(:a_save).twice
    CallbackStub.any_instance.expects(:a_find)
    CallbackStub.any_instance.expects(:b_update)
    CallbackStub.any_instance.expects(:a_update)
    cb = CallbackStub.new
    cb.save

    cb2 = CallbackStub.find(cb.pid)
    cb2.save
  end

end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
active-fedora-4.2.0 spec/unit/callback_spec.rb
active-fedora-4.1.0 spec/unit/callback_spec.rb
active-fedora-4.0.0 spec/unit/callback_spec.rb
active-fedora-4.0.0.rc20 spec/unit/callback_spec.rb
active-fedora-4.0.0.rc19 spec/unit/callback_spec.rb
active-fedora-4.0.0.rc18 spec/unit/callback_spec.rb
active-fedora-4.0.0.rc17 spec/unit/callback_spec.rb
active-fedora-4.0.0.rc16 spec/unit/callback_spec.rb
active-fedora-4.0.0.rc15 spec/unit/callback_spec.rb
active-fedora-4.0.0.rc14 spec/unit/callback_spec.rb
active-fedora-4.0.0.rc13 spec/unit/callback_spec.rb
active-fedora-4.0.0.rc12 spec/unit/callback_spec.rb
active-fedora-4.0.0.rc11 spec/unit/callback_spec.rb
active-fedora-4.0.0.rc10 spec/unit/callback_spec.rb
active-fedora-4.0.0.rc9 spec/unit/callback_spec.rb
active-fedora-4.0.0.rc8 spec/unit/callback_spec.rb
active-fedora-4.0.0.rc7 spec/unit/callback_spec.rb
active-fedora-4.0.0.rc6 spec/unit/callback_spec.rb
active-fedora-4.0.0.rc5 spec/unit/callback_spec.rb
active-fedora-4.0.0.rc4 spec/unit/callback_spec.rb