Sha256: 5dd26cc3e89333b8c4e29fd8bbd27de7356ab006bfc8bc5d3abb9acc0df296f8

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require 'test/unit'
require 'mega/orm_support'

# fixtures

class Vendor
end

module MockMod
  class Customer
  end
end

# test

class TC_ORMSupport < Test::Unit::TestCase

  # tablename

  def test_tablename
    assert_equal( 'vendor', "Vendor".tablename )
    assert_equal( 'mockmod_customer', "MockMod::Customer".tablename )
  end

  # tableize

  def test_tableize
    assert_equal( 'vendor', "Vendor".tableize )
    assert_equal( 'mockmod_customer', "MockMod::Customer".tableize )
  end

  # classname

  def test_classname
    assert_equal( 'Vendor', "vendor".classname )
    assert_equal( 'Mockmod::Customer', "mockmod_customer".classname )
  end

  # classify

  def test_classify
    assert_equal( Vendor, "vendor".classify )
    assert_equal( MockMod::Customer, "mockmod_customer".classify )
  end

  # keyname

  def test_keyname
    assert_equal( 'vendor_id', "Vendor".keyname )
    assert_equal( 'customer_id', "MockMod::Customer".keyname )
    assert_equal( 'customerid', "MockMod::Customer".keyname( :id ) )
  end

  # foriegn_key

  def test_foriegn_key
    assert_equal( 'vendor_id', "Vendor".foreign_key )
    assert_equal( 'customer_id', "MockMod::Customer".foreign_key )
    assert_equal( 'customerid', "MockMod::Customer".foreign_key( :id ) )
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mega-0.3.1 test/tc_orm_support.rb