Sha256: f5a3d2c3f0596bd27a17191c6004a02d33ae74f435240aa4b2543aa6cc9dd90b

Contents?: true

Size: 832 Bytes

Versions: 25

Compression:

Stored size: 832 Bytes

Contents

require 'cases/sqlserver_helper'
require 'models/order'

class SqlServerRailsOrders < ActiveRecord::Base
  set_table_name 'rails.orders'
end

class TableNameTestSqlserver < ActiveRecord::TestCase
  
  self.use_transactional_fixtures = false
  
  def setup
    Order.table_name = '[orders]'
    Order.reset_column_information
  end
  
  should 'load columns with escaped table name for model' do
    assert_equal 4, Order.columns.length
  end
  
  should 'not re-escape table name if it is escaped already for SQL queries' do
    assert_sql(/SELECT \* FROM \[orders\]/) { Order.all }
  end
  
  context 'Table scoped to user.table_name' do

    setup do
      @klass = SqlServerRailsOrders
    end

    should 'have no issue doing basic column reflection' do
      assert_nothing_raised() { @klass.columns }
    end

  end
  
  
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
activerecord-sqlserver-adapter-2.3.24 test/cases/table_name_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.23 test/cases/table_name_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.22 test/cases/table_name_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.21 test/cases/table_name_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.20 test/cases/table_name_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.19 test/cases/table_name_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.18 test/cases/table_name_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.17 test/cases/table_name_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.16 test/cases/table_name_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.15 test/cases/table_name_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.13 test/cases/table_name_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.12 test/cases/table_name_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.11 test/cases/table_name_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.10 test/cases/table_name_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.9 test/cases/table_name_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.8 test/cases/table_name_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.7 test/cases/table_name_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.6 test/cases/table_name_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.5 test/cases/table_name_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.4 test/cases/table_name_test_sqlserver.rb