Sha256: 5b2d9614b7d5b2413cb2f386794eeeab6e0b8b9d6c9bf01b5309a15a3bfe7195
Contents?: true
Size: 1.9 KB
Versions: 1
Compression:
Stored size: 1.9 KB
Contents
require 'spec_helper' describe Noodall::Component do it "should list components classes avaiable to a slot (deprecated)" do Noodall::Node.slots :dwide, :dsmall, :dmain class DListedComponent < Noodall::Component allowed_positions :dsmall, :dwide end Noodall::Node.dsmall_slot_components.should include(DListedComponent) Noodall::Node.dmain_slot_components.should_not include(DListedComponent) end it "should list components classes avaiable to a slot" do class ListedComponent < Noodall::Component end Noodall::Node.slot :small, ListedComponent, Content Noodall::Node.slot :main, Content Noodall::Node.small_slot_components.should include(ListedComponent) Noodall::Node.main_slot_components.should_not include(ListedComponent) end it "should be validated by the node (deprecated)" do Noodall::Node.slots :wide, :small, :main class DValidatedComponent < Noodall::Component allowed_positions :small, :wide end class DValidatedNode < Noodall::Node main_slots 3 end node = DValidatedNode.new :title => "Slot Node" node.main_slot_0 = DValidatedComponent.new node.save node.errors.should have(1).things end it "should be validated by the node" do class ValidatedComponent < Noodall::Component end Noodall::Node.slot :middle, ValidatedComponent Noodall::Node.slot :main, Content class ValidatedNode < Noodall::Node main_slots 1 end node = ValidatedNode.new :title => "Slot Node" node.main_slot_0 = ValidatedComponent.new node.save node.errors.should have(1).things end it "should know it's node" do Noodall::Node.slot :small, Content class KnowingNode < Noodall::Node small_slots 3 end node = KnowingNode.new :title => "Slot Node" node.small_slot_0 = Factory(:content) node.save! node.small_slot_0.node.should == node end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
noodall-core-0.8.2 | spec/component_spec.rb |