Sha256: 59f2e49779ff552bde355adacee64c3672c5a5d77e25de4cecb2d0418053a4f1

Contents?: true

Size: 1.2 KB

Versions: 19

Compression:

Stored size: 1.2 KB

Contents

require File.join(File.expand_path(File.dirname(__FILE__)), "..","..","spec_helper")

describe Pancake::Mixins::StackHelper do
  before do
    class ::FooStack < Pancake::Stack
      class Bar
        include Pancake::Mixins::StackHelper
      end
    end
  end

  after do
    clear_constants :FooStack, :BarStack, :FooBar
  end

  it "should provide access to the stack helper to the Bar class" do
    FooStack::Bar.stack_class.should == FooStack
  end

  it "should track the class for a newly namespaced stack" do
    class ::BarStack < FooStack
      class Bar < ::FooStack::Bar
      end
    end

    BarStack::Bar.stack_class.should == BarStack
  end

  it "should raise an exception when including it into a class that is not of a stack" do
    lambda do
      class ::FooBar
        include Pancake::Mixins::StackHelper
      end
    end.should raise_error
  end

  it "should remember the stack it was initially mixed into if it's inherited to a non namespaced class" do
    class ::FooBar < FooStack::Bar; end
    FooBar.stack_class.should == FooStack
  end
  
  it "should provide access to the stack helper from an instance of the Bar class" do
    FooStack::Bar.new.stack_class.should == FooStack
  end
  
end

Version data entries

19 entries across 19 versions & 2 rubygems

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