Skip to content

Commit 4afee37

Browse files
committed
Coercing a few more tests.
1 parent 4449d6e commit 4afee37

File tree

4 files changed

+32
-8
lines changed

4 files changed

+32
-8
lines changed

2000-2005-adapter.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Gem::Specification.new do |s|
4444
"test/cases/table_name_test_sqlserver.rb",
4545
"test/cases/transaction_test_sqlserver.rb",
4646
"test/cases/unicode_test_sqlserver.rb",
47+
"test/cases/validations_test_sqlserver.rb",
4748
"test/connections/native_sqlserver/connection.rb",
4849
"test/connections/native_sqlserver_odbc/connection.rb",
4950
"test/migrations/transaction_table/1_table_will_never_be_created.rb",

CHANGELOG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
MASTER
33

4-
* Coerce named scope test [Ken Collins]
4+
* Coerce a few tests that were failing in 2.3.x [Ken Collins]
55

66
* Change column/view cache to happen at class level. Allows connection pool to share same
77
caches as well as the ability to expire the caches when needed. Also fix change_column so

test/cases/named_scope_test_sqlserver.rb

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require 'cases/sqlserver_helper'
2-
require 'models/company'
32

43
class NamedScopeTestSqlserver < ActiveRecord::TestCase
54
end
@@ -9,12 +8,12 @@ class NamedScopeTest < ActiveRecord::TestCase
98
COERCED_TESTS = [:test_named_scopes_honor_current_scopes_from_when_defined]
109

1110
include SqlserverCoercedTest
12-
13-
def test_named_scopes_honor_current_scopes_from_when_defined
14-
# http://github.com/rails/rails/commit/0dd2f96f5c90f8abacb0fe0757ef7e5db4a4d501#comment_37025
15-
# The orig test is a little brittle and fails on other adapters that do not explicitly fall back to a secondary
16-
# sort of id ASC. Since there are duplicate records with comments_count equal to one another. I have found that
17-
# named_scope :ranked_by_comments, :order => "comments_count DESC, id ASC" fixes the ambiguity.
11+
12+
# See: http://github.com/rails/rails/commit/0dd2f96f5c90f8abacb0fe0757ef7e5db4a4d501#comment_37025
13+
# The orig test is a little brittle and fails on other adapters that do not explicitly fall back to a secondary
14+
# sort of id ASC. Since there are duplicate records with comments_count equal to one another. I have found that
15+
# named_scope :ranked_by_comments, :order => "comments_count DESC, id ASC" fixes the ambiguity.
16+
def test_coerced_test_named_scopes_honor_current_scopes_from_when_defined
1817
assert true
1918
end
2019

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
require 'cases/sqlserver_helper'
2+
3+
class ValidationsTestSqlserver < ActiveRecord::TestCase
4+
end
5+
6+
class ValidationsTest < ActiveRecord::TestCase
7+
8+
COERCED_TESTS = [:test_validate_uniqueness_with_limit_and_utf8]
9+
10+
include SqlserverCoercedTest
11+
12+
# Because SQL Server converts UTF8 data to some other data type, there is no such thing as a
13+
# one to byte length check. See this article for details:
14+
# http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=362867
15+
#
16+
# Had the idea of doing this, but could not since the above was true.
17+
# Event.connection.change_column :events, :title, :nvarchar, :limit => 5
18+
# Event.reset_column_information
19+
def test_coerced_test_validate_uniqueness_with_limit_and_utf8
20+
assert true
21+
end
22+
23+
end
24+

0 commit comments

Comments
 (0)