Sha256: fd9b5232a66e701cab42416f6bcec06f7289f8085c388675ae877eeb1c29a091
Contents?: true
Size: 1.57 KB
Versions: 3
Compression:
Stored size: 1.57 KB
Contents
require 'spec_helper' # The dag link functionality is tested extensively in the corresponding `acts-as-dag` gem. # This test is just to make sure that the integration is propery done. Therefore, some basic scenarios are tested here. # # We use the Page model here to represent the dag's node objects, since it's a relatively simple model, which is already # present in the database. If the Page model should become more extensive in the future, it's recommended to refactor # this test to use a new model, perhaps defined in the test itself. # describe "Page (DagLinkNode)" do def setup_pages @page = FactoryGirl.create( :page ) @parent = FactoryGirl.create( :page ) @grandfather = FactoryGirl.create( :page ) @page.parent_pages << @parent @parent.parent_pages << @grandfather end before { setup_pages } describe "#ancestors" do it "should return all ancestors, not only the parents" do @page.ancestors.should include( @parent, @grandfather ) end end describe "#descendants" do it "should return all descendants, not only the children" do @grandfather.descendants.should include( @parent, @page ) end end describe "#parents" do it "should return only the parents rather than all ancestors" do @page.parents.should include( @parent ) @page.parents.should_not include( @grandfather ) end end describe "#children" do it "should return only the children rather than all descendants" do @grandfather.children.should include( @parent ) @grandfather.children.should_not include( @page ) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
your_platform-1.0.1 | spec/models/dag_link_spec.rb |
your_platform-1.0.0 | spec/models/dag_link_spec.rb |
your_platform-0.0.2 | spec/models/dag_link_spec.rb |