Sha256: 088bc049db2841ea10b88111bfd22a411ec2546332e54121562ad98803898a92

Contents?: true

Size: 776 Bytes

Versions: 92

Compression:

Stored size: 776 Bytes

Contents

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

Version data entries

92 entries across 92 versions & 7 rubygems

Version Path
jstorimer-deep-test-2.0.0 sample_rails_project/vendor/rails/activerecord/test/table_name_test_sqlserver.rb
jstorimer-deep-test-1.4.0 sample_rails_project/vendor/rails/activerecord/test/table_name_test_sqlserver.rb
jstorimer-deep-test-1.3.0 sample_rails_project/vendor/rails/activerecord/test/table_name_test_sqlserver.rb
jstorimer-deep-test-1.2.0 sample_rails_project/vendor/rails/activerecord/test/table_name_test_sqlserver.rb
jstorimer-deep-test-1.1.0 sample_rails_project/vendor/rails/activerecord/test/table_name_test_sqlserver.rb
jstorimer-deep-test-1.0.0 sample_rails_project/vendor/rails/activerecord/test/table_name_test_sqlserver.rb
jstorimer-deep-test-0.2.0 sample_rails_project/vendor/rails/activerecord/test/table_name_test_sqlserver.rb
jstorimer-deep-test-0.1.0 sample_rails_project/vendor/rails/activerecord/test/table_name_test_sqlserver.rb
activerecord-1.15.1 test/table_name_test_sqlserver.rb
activerecord-1.15.0 test/table_name_test_sqlserver.rb
activerecord-1.15.4 test/table_name_test_sqlserver.rb
activerecord-1.15.3 test/table_name_test_sqlserver.rb
activerecord-1.15.2 test/table_name_test_sqlserver.rb
activerecord-1.15.6 test/table_name_test_sqlserver.rb
activerecord-1.15.5 test/table_name_test_sqlserver.rb
activerecord-2.0.1 test/table_name_test_sqlserver.rb
activerecord-2.0.0 test/table_name_test_sqlserver.rb
activerecord-2.0.5 test/table_name_test_sqlserver.rb
activerecord-2.0.2 test/table_name_test_sqlserver.rb
activerecord-2.0.4 test/table_name_test_sqlserver.rb