diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-03-03 14:20:57 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-03-03 14:20:57 +0000 |
commit | b2c0359b3e63f472a1ff8bf02061c97dafb98a34 (patch) | |
tree | d5546157fc9b17199ca4d0205b2b1812b896364a /activerecord/test/adapter_test_sqlserver.rb | |
parent | f254831e8309ce6ec74cc30a46a68bb5c2ffb6df (diff) | |
download | rails-b2c0359b3e63f472a1ff8bf02061c97dafb98a34.tar.gz rails-b2c0359b3e63f472a1ff8bf02061c97dafb98a34.tar.bz2 rails-b2c0359b3e63f472a1ff8bf02061c97dafb98a34.zip |
SQLServer: recognize real column type as Ruby float, correctly schema-dump tables with no indexes or descending indexes. References #7057, #7703. Closes #7333.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6297 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/adapter_test_sqlserver.rb')
-rw-r--r-- | activerecord/test/adapter_test_sqlserver.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/activerecord/test/adapter_test_sqlserver.rb b/activerecord/test/adapter_test_sqlserver.rb index bf74671209..548668d5e7 100644 --- a/activerecord/test/adapter_test_sqlserver.rb +++ b/activerecord/test/adapter_test_sqlserver.rb @@ -4,6 +4,8 @@ require 'fixtures/post' require 'fixtures/task'
class SqlServerAdapterTest < Test::Unit::TestCase
+ class TableWithRealColumn < ActiveRecord::Base; end
+
fixtures :posts, :tasks
def setup
@@ -11,7 +13,11 @@ class SqlServerAdapterTest < Test::Unit::TestCase end
def teardown
- @connection.execute("SET LANGUAGE us_english")
+ @connection.execute("SET LANGUAGE us_english") rescue nil
+ end
+
+ def test_real_column_has_float_type
+ assert_equal :float, TableWithRealColumn.columns_hash["real_number"].type
end
# SQL Server 2000 has a bug where some unambiguous date formats are not
@@ -24,6 +30,14 @@ class SqlServerAdapterTest < Test::Unit::TestCase end
end
+ def test_indexes_with_descending_order
+ # Make sure we have an index with descending order
+ @connection.execute "CREATE INDEX idx_credit_limit ON accounts (credit_limit DESC)" rescue nil
+ assert_equal ["credit_limit"], @connection.indexes('accounts').first.columns
+ ensure
+ @connection.execute "DROP INDEX accounts.idx_credit_limit"
+ end
+
def test_execute_without_block_closes_statement
assert_all_statements_used_are_closed do
@connection.execute("SELECT 1")
|