Sha256: 874e239bbce11bcfe34ae35d9145771600c0db43796678677e433e5477db2797
Contents?: true
Size: 1.5 KB
Versions: 1
Compression:
Stored size: 1.5 KB
Contents
require 'spec_helper' describe "Pancake::Stack inheritance" do describe "inheritance hooks" do before(:all) do $on_inherit_blocks = Pancake::Stack.on_inherit.dup end after(:all) do Pancake::Stack.on_inherit.clear $on_inherit_blocks.each do |blk| Pancake::Stack.on_inherit(&blk) end end before(:each) do $collector = [] clear_constants(:FooStack) Pancake::Stack.on_inherit.clear end after(:each) do clear_constants(:FooStack) end it "should be able to add inheritance hooks" do Pancake::Stack.on_inherit do |base, parent| $collector << base end class ::FooStack < Pancake::Stack; end $collector.should == [FooStack] end it "should be able to add multiple inheritance hooks" do Pancake::Stack.on_inherit{|b,p| $collector << b} Pancake::Stack.on_inherit{|b,p| $collector << :foo} class ::FooStack < Pancake::Stack end $collector.should == [FooStack, :foo] end end describe "Inheriting Stacks" do before(:all) do clear_constants(:FooStack, :BarStack) end before(:each) do class ::FooStack < Pancake::Stack; end end after(:each) do clear_constants(:FooStack, :BarStack) end describe "configuration" do it "should inherit the configuration with a stack" do class ::BarStack < ::FooStack; end BarStack::Configuration.should inherit_from(FooStack::Configuration) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pancake-0.3.0 | spec/pancake/hooks/on_inherit_spec.rb |