Sha256: fc1803fedede39f3a473d905c7930a3c2490649cf9b77aa4361f650dfd5988c2
Contents?: true
Size: 1.76 KB
Versions: 50
Compression:
Stored size: 1.76 KB
Contents
require 'spec_helper' describe ActiveFedora::Base do before :all do class CallbackStub < ActiveFedora::Base has_metadata :type=>ActiveFedora::SimpleDatastream, :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 before_destroy :do_stuff def do_stuff :noop end 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, before_destroy" do CallbackStub.any_instance.should_receive(:a_init) CallbackStub.any_instance.should_receive :b_create CallbackStub.any_instance.should_receive :a_create CallbackStub.any_instance.should_receive(:b_save) CallbackStub.any_instance.should_receive(:a_save) cb = CallbackStub.new :pid => 'test:123' cb.save end it "Should have after_initialize, before_save,after_save, before_create, after_create, after_update, before_update, before_destroy" do CallbackStub.any_instance.should_receive(:a_init) CallbackStub.any_instance.should_receive(:b_save) CallbackStub.any_instance.should_receive(:a_save) CallbackStub.any_instance.should_receive(:a_find) CallbackStub.any_instance.should_receive(:b_update) CallbackStub.any_instance.should_receive(:a_update) CallbackStub.any_instance.should_receive(:do_stuff) cb2 = CallbackStub.find('test:123') cb2.save cb2.destroy end end
Version data entries
50 entries across 50 versions & 1 rubygems