Permalink
Browse files

Improve ActiveRecord::Base#table_name unit tests for nested classes. …

…Closes #10289. [scott_willson]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9237 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 2cdc613 commit 4b68982f649c5b230b3e99954a71404c7cec03c7 @josh josh committed Apr 7, 2008
Showing with 7 additions and 0 deletions.
  1. +5 −0 activerecord/test/cases/modules_test.rb
  2. +2 −0 activerecord/test/models/company_in_module.rb
@@ -31,4 +31,9 @@ def test_find_account_and_include_company
assert_kind_of MyApplication::Business::Firm, account.firm
end
+ def test_table_name
+ assert_equal 'accounts', MyApplication::Billing::Account.table_name, 'table_name for ActiveRecord model in module'
+ assert_equal 'companies', MyApplication::Business::Client.table_name, 'table_name for ActiveRecord model subclass'
+ assert_equal 'company_contacts', MyApplication::Business::Client::Contact.table_name, 'table_name for ActiveRecord model enclosed by another ActiveRecord model'
+ end
end
@@ -17,6 +17,8 @@ class Firm < Company
class Client < Company
belongs_to :firm, :foreign_key => "client_of"
belongs_to :firm_with_other_name, :class_name => "Firm", :foreign_key => "client_of"
+
+ class Contact < ActiveRecord::Base; end
end
class Developer < ActiveRecord::Base

0 comments on commit 4b68982

Please sign in to comment.