Sha256: 7cd140d11c71b1d48c7f411791d97ac7c1d5eae251fc7ca4612d82f3b8f67cdd

Contents?: true

Size: 1.56 KB

Versions: 19

Compression:

Stored size: 1.56 KB

Contents

require File.dirname(__FILE__) + '/../../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

19 entries across 19 versions & 2 rubygems

Version Path
hassox-pancake-0.1.6 spec/pancake/hooks/on_inherit_spec.rb
pancake-0.2.0 spec/pancake/hooks/on_inherit_spec.rb
pancake-0.1.29 spec/pancake/hooks/on_inherit_spec.rb
pancake-0.1.28 spec/pancake/hooks/on_inherit_spec.rb
pancake-0.1.27 spec/pancake/hooks/on_inherit_spec.rb
pancake-0.1.26 spec/pancake/hooks/on_inherit_spec.rb
pancake-0.1.25 spec/pancake/hooks/on_inherit_spec.rb
pancake-0.1.24 spec/pancake/hooks/on_inherit_spec.rb
pancake-0.1.22 spec/pancake/hooks/on_inherit_spec.rb
pancake-0.1.20 spec/pancake/hooks/on_inherit_spec.rb
pancake-0.1.19 spec/pancake/hooks/on_inherit_spec.rb
pancake-0.1.18 spec/pancake/hooks/on_inherit_spec.rb
pancake-0.1.17 spec/pancake/hooks/on_inherit_spec.rb
pancake-0.1.16 spec/pancake/hooks/on_inherit_spec.rb
pancake-0.1.15 spec/pancake/hooks/on_inherit_spec.rb
pancake-0.1.13 spec/pancake/hooks/on_inherit_spec.rb
pancake-0.1.12 spec/pancake/hooks/on_inherit_spec.rb
pancake-0.1.10 spec/pancake/hooks/on_inherit_spec.rb
pancake-0.1.8 spec/pancake/hooks/on_inherit_spec.rb