mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
9073cef866
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5891 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
23 lines
776 B
Ruby
23 lines
776 B
Ruby
require 'abstract_unit'
|
|
require "#{File.dirname(__FILE__)}/../lib/active_record/schema"
|
|
|
|
if ActiveRecord::Base.connection.supports_migrations?
|
|
class Order < ActiveRecord::Base
|
|
self.table_name = '[order]'
|
|
end
|
|
|
|
class TableNameTest < Test::Unit::TestCase
|
|
self.use_transactional_fixtures = false
|
|
|
|
# Ensures Model.columns works when using SQLServer escape characters.
|
|
# Enables legacy schemas using SQL reserved words as table names.
|
|
# Should work with table names with spaces as well ('table name').
|
|
def test_escaped_table_name
|
|
assert_nothing_raised do
|
|
ActiveRecord::Base.connection.select_all 'SELECT * FROM [order]'
|
|
end
|
|
assert_equal '[order]', Order.table_name
|
|
assert_equal 5, Order.columns.length
|
|
end
|
|
end
|
|
end
|