Sha256: 6925bfaa15b99229adeda70e16c9fef4410e076032a775d7665f24ef68e8f953
Contents?: true
Size: 1.3 KB
Versions: 34
Compression:
Stored size: 1.3 KB
Contents
require File.join(File.dirname(__FILE__), '/../../spec_helper') describe InitializerHooks do before(:each) do @class = Class.new do include InitializerHooks def initialize after_initialize end def to_s "TestClass" end end end describe "register" do it "should instance eval the given hook on initializing" do InitializerHooks.register @class do raise "Hook called in #{self}" end lambda { @class.new }.should raise_error("Hook called in TestClass") end end describe "append" do it "should instance eval the given hook on initializing" do InitializerHooks.register @class do raise "Hook called in #{self}" end InitializerHooks.append @class do raise "Appended hook called in #{self}" end lambda { @class.new }.should raise_error("Hook called in TestClass") end end describe "prepend" do it "should instance eval the given hook on initializing" do InitializerHooks.register @class do raise "Hook called in #{self}" end InitializerHooks.prepend @class do raise "Prepended hook called in #{self}" end lambda { @class.new }.should raise_error("Prepended hook called in TestClass") end end end
Version data entries
34 entries across 34 versions & 1 rubygems