Skip to content

Commit 553bf8c

Browse files
committed
Fix a few test from ActiveRecord 3.2.6 upgrade.
1 parent 4847ce7 commit 553bf8c

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

CHANGELOG

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11

2+
* 3.2.5 *
3+
4+
* Fix a few test from ActiveRecord 3.2.6 upgrade.
5+
6+
27
* 3.2.4 *
38

49
* Fixed schema reflection for identity columns using ODBC. Fixes #193.

lib/active_record/connection_adapters/sqlserver/schema_statements.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def rename_table(table_name, new_name)
5050

5151
def remove_column(table_name, *column_names)
5252
raise ArgumentError.new("You must specify at least one column name. Example: remove_column(:people, :first_name)") if column_names.empty?
53+
ActiveSupport::Deprecation.warn 'Passing array to remove_columns is deprecated, please use multiple arguments, like: `remove_columns(:posts, :foo, :bar)`', caller if column_names.flatten!
5354
column_names.flatten.each do |column_name|
5455
remove_check_constraints(table_name, column_name)
5556
remove_default_constraint(table_name, column_name)

lib/active_record/connection_adapters/sqlserver/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module ConnectionAdapters
33
module Sqlserver
44
module Version
55

6-
VERSION = '3.2.4'
6+
VERSION = '3.2.5'
77

88
end
99
end

test/cases/finder_test_sqlserver.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,19 @@ class FinderTestSqlserver < ActiveRecord::TestCase
77
class FinderTest < ActiveRecord::TestCase
88

99
COERCED_TESTS = [
10+
:test_exists_does_not_select_columns_without_alias,
1011
:test_string_sanitation,
1112
:test_first_and_last_with_integer_should_use_sql_limit
1213
]
1314

1415
include SqlserverCoercedTest
1516

17+
def test_coerced_exists_does_not_select_columns_without_alias
18+
assert_sql(/SELECT TOP \(1\) 1 AS one FROM \[topics\]/i) do
19+
Topic.exists?
20+
end
21+
end
22+
1623
def test_coerced_string_sanitation
1724
assert_not_equal "N'something ' 1=1'", ActiveRecord::Base.sanitize("something ' 1=1")
1825
assert_equal "N'something; select table'", ActiveRecord::Base.sanitize("something; select table")

0 commit comments

Comments
 (0)