Sha256: 2c713fa55b846064c2170ad0a38686eccc9f7948b284617d440c7714774e82e5

Contents?: true

Size: 744 Bytes

Versions: 25

Compression:

Stored size: 744 Bytes

Contents

require "cases/helper"
require 'active_record/schema'

if ActiveRecord::Base.connection.supports_migrations?
  class Order < ActiveRecord::Base
    self.table_name = '[order]'
  end

  class TableNameTest < ActiveRecord::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

Version data entries

25 entries across 25 versions & 7 rubygems

Version Path
3mix-castronaut-0.5.0.2 vendor/activerecord/test/cases/table_name_test_sqlserver.rb
masover-castronaut-0.4.4.4 vendor/activerecord/test/cases/table_name_test_sqlserver.rb
masover-castronaut-0.4.4.5 vendor/activerecord/test/cases/table_name_test_sqlserver.rb
masover-castronaut-0.5.0.1 vendor/activerecord/test/cases/table_name_test_sqlserver.rb
relevance-castronaut-0.4.1 vendor/activerecord/test/cases/table_name_test_sqlserver.rb
relevance-castronaut-0.4.2 vendor/activerecord/test/cases/table_name_test_sqlserver.rb
relevance-castronaut-0.4.3 vendor/activerecord/test/cases/table_name_test_sqlserver.rb
relevance-castronaut-0.4.4 vendor/activerecord/test/cases/table_name_test_sqlserver.rb
relevance-castronaut-0.4.5 vendor/activerecord/test/cases/table_name_test_sqlserver.rb
relevance-castronaut-0.4.6 vendor/activerecord/test/cases/table_name_test_sqlserver.rb
relevance-castronaut-0.5.0 vendor/activerecord/test/cases/table_name_test_sqlserver.rb
relevance-castronaut-0.5.1 vendor/activerecord/test/cases/table_name_test_sqlserver.rb
relevance-castronaut-0.5.2 vendor/activerecord/test/cases/table_name_test_sqlserver.rb
relevance-castronaut-0.5.3 vendor/activerecord/test/cases/table_name_test_sqlserver.rb
relevance-castronaut-0.5.4 vendor/activerecord/test/cases/table_name_test_sqlserver.rb
radiant-0.7.2 vendor/rails/activerecord/test/cases/table_name_test_sqlserver.rb
vibes-bj-1.2.2 spec/rails_root/vendor/rails/activerecord/test/cases/table_name_test_sqlserver.rb
vibes-bj-1.2.1 spec/rails_root/vendor/rails/activerecord/test/cases/table_name_test_sqlserver.rb
activerecord-2.1.2 test/cases/table_name_test_sqlserver.rb
activerecord-2.1.0 test/cases/table_name_test_sqlserver.rb