Sha256: abefcd572691788bb63a6ca079c485fed4b81a8c6640b0b2427fa461dc85942d
Contents?: true
Size: 794 Bytes
Versions: 7
Compression:
Stored size: 794 Bytes
Contents
require 'spec_helper' def assert_lineage(e, m) m.parent.should == e m.self_and_ancestors.should == [m, e] # make sure reloading doesn't affect the self_and_ancestors: m.reload m.self_and_ancestors.should == [m, e] end describe CuisineType do it "finds self and parents when children << is used" do e = CuisineType.new(:name => "e") m = CuisineType.new(:name => "m") e.children << m e.save assert_lineage(e, m) end it "finds self and parents properly if the constructor is used" do e = CuisineType.create(:name => "e") m = CuisineType.create(:name => "m", :parent => e) assert_lineage(e, m) end it "sets the table_name of the hierarchy class properly" do CuisineTypeHierarchy.table_name.should == "cuisine_type_hierarchies" end end
Version data entries
7 entries across 7 versions & 1 rubygems