Sha256: 7c414d3a18958ce16015680b20202ae6e26bb6f75ee9b713e894e8b3c3b14d98

Contents?: true

Size: 872 Bytes

Versions: 75

Compression:

Stored size: 872 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 == ActiveRecord::Base.table_name_prefix + "cuisine_type_hierarchies" + ActiveRecord::Base.table_name_suffix
  end
end

Version data entries

75 entries across 75 versions & 2 rubygems

Version Path
lalala-4.0.0.dev.72 vendor/deps/closure_tree/spec/cuisine_type_spec.rb
lalala-4.0.0.dev.71 vendor/deps/closure_tree/spec/cuisine_type_spec.rb
lalala-4.0.0.dev.66 vendor/deps/closure_tree/spec/cuisine_type_spec.rb
lalala-4.0.0.dev.65 vendor/deps/closure_tree/spec/cuisine_type_spec.rb
lalala-4.0.0.dev.64 vendor/deps/closure_tree/spec/cuisine_type_spec.rb
lalala-4.0.0.dev.63 vendor/deps/closure_tree/spec/cuisine_type_spec.rb
lalala-4.0.0.dev.62 vendor/deps/closure_tree/spec/cuisine_type_spec.rb
lalala-4.0.0.dev.61 vendor/deps/closure_tree/spec/cuisine_type_spec.rb
lalala-4.0.0.dev.60 vendor/deps/closure_tree/spec/cuisine_type_spec.rb
lalala-4.0.0.dev.59 vendor/deps/closure_tree/spec/cuisine_type_spec.rb
lalala-4.0.0.dev.58 vendor/deps/closure_tree/spec/cuisine_type_spec.rb
lalala-4.0.0.dev.57 vendor/deps/closure_tree/spec/cuisine_type_spec.rb
lalala-4.0.0.dev.56 vendor/deps/closure_tree/spec/cuisine_type_spec.rb
lalala-4.0.0.dev.50 vendor/deps/closure_tree/spec/cuisine_type_spec.rb
lalala-4.0.0.dev.46 vendor/deps/closure_tree/spec/cuisine_type_spec.rb
closure_tree-3.10.1 spec/cuisine_type_spec.rb
closure_tree-3.10.0 spec/cuisine_type_spec.rb
closure_tree-3.9.0 spec/cuisine_type_spec.rb
closure_tree-3.8.2 spec/cuisine_type_spec.rb
closure_tree-3.8.1 spec/cuisine_type_spec.rb