Sha256: fba821bbc5276154bc642ee293461ff0185b2dbc5766462afbe946a95eb80ae2

Contents?: true

Size: 1.13 KB

Versions: 41

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

describe Noodall::Component do

  it "should allow you to define the slots that are available" do
    Noodall::Node.slots :wide, :small, :main

    Noodall::Component.possible_slots.should == [:wide, :small, :main]

    class Promo < Noodall::Component
      allowed_positions :small, :wide, :main, :egg, :nog
    end

    Promo.positions.should have(3).things
  end

  it "should list components classes avaiable to a slot" do

    class Promo < Noodall::Component
      allowed_positions :small, :wide
    end

    Promo.positions.should have(2).things

    Noodall::Component.positions_classes(:small).should include(Promo)
    Noodall::Component.positions_classes(:main).should_not include(Promo)
  end

  it "should be validated by the node" do
    class Promo < Noodall::Component
      allowed_positions :small, :wide
    end

    node = Factory(:page)
    node.main_slot_0 = Promo.new()
  
    node.save
  
    node.errors.should have(1).things
  end

  it "should know it's node" do
    node = Factory(:page)
    node.small_slot_0 = Factory(:content) 

    node.save!

    node.small_slot_0.node.should == node
  end

end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
noodall-core-0.7.5 spec/component_spec.rb
noodall-core-0.7.3 spec/component_spec.rb
noodall-core-0.7.2 spec/component_spec.rb
noodall-core-0.6.3 spec/component_spec.rb
noodall-core-0.6.2 spec/component_spec.rb
noodall-core-0.6.1 spec/component_spec.rb
noodall-core-0.5.7 spec/component_spec.rb
noodall-core-0.6.0 spec/component_spec.rb
noodall-core-0.5.6 spec/component_spec.rb
noodall-core-0.5.5 spec/component_spec.rb
noodall-core-0.5.4 spec/component_spec.rb
noodall-core-0.5.3 spec/component_spec.rb
noodall-core-0.5.1 spec/component_spec.rb
noodall-core-0.5.0 spec/component_spec.rb
noodall-core-0.4.8 spec/component_spec.rb
noodall-core-0.4.7 spec/component_spec.rb
noodall-core-0.4.6 spec/component_spec.rb
noodall-core-0.4.5 spec/component_spec.rb
noodall-core-0.4.3 spec/component_spec.rb
noodall-core-0.4.2 spec/component_spec.rb