Skip to content

Commit 65e56c3

Browse files
committed
Coerce a few tests for 3.1.1.rc2. Includes bcrypt for out tests to run.
1 parent 2d7171d commit 65e56c3

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ else
77
spec = eval(File.read('activerecord-sqlserver-adapter.gemspec'))
88
ar_version = spec.dependencies.detect{ |d|d.name == 'activerecord' }.requirement.requirements.first.last.version
99
gem 'rails', :git => "git://github.com/rails/rails.git", :tag => "v#{ar_version}"
10+
gem 'bcrypt-ruby', '~> 3.0.0'
1011
end
1112

1213
if ENV['AREL']

lib/active_record/connection_adapters/sqlserver/schema_statements.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def tables(name = nil, table_type = 'BASE TABLE')
1414
end
1515

1616
def table_exists?(table_name)
17+
return false if table_name.blank?
1718
unquoted_table_name = unqualify_table_name(table_name)
1819
super || tables.include?(unquoted_table_name) || views.include?(unquoted_table_name)
1920
end

test/cases/finder_test_sqlserver.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ class FinderTestSqlserver < ActiveRecord::TestCase
66

77
class FinderTest < ActiveRecord::TestCase
88

9-
COERCED_TESTS = [:test_string_sanitation]
9+
COERCED_TESTS = [
10+
:test_string_sanitation,
11+
:test_first_and_last_with_integer_should_use_sql_limit
12+
]
1013

1114
include SqlserverCoercedTest
1215

@@ -15,5 +18,10 @@ def test_coerced_string_sanitation
1518
assert_equal "N'something; select table'", ActiveRecord::Base.sanitize("something; select table")
1619
end
1720

21+
def test_coerced_first_and_last_with_integer_should_use_sql_limit
22+
assert_sql(/TOP \(2\)/) { Topic.first(2).entries }
23+
assert_sql(/TOP \(5\)/) { Topic.last(5).entries }
24+
end
25+
1826
end
1927

0 commit comments

Comments
 (0)