Skip to content

Commit 4449d6e

Browse files
committed
Coerce named scope test.
1 parent 3f06f33 commit 4449d6e

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

2000-2005-adapter.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Gem::Specification.new do |s|
3434
"test/cases/inheritance_test_sqlserver.rb",
3535
"test/cases/method_scoping_test_sqlserver.rb",
3636
"test/cases/migration_test_sqlserver.rb",
37+
"test/cases/named_scope_test_sqlserver.rb",
3738
"test/cases/offset_and_limit_test_sqlserver.rb",
3839
"test/cases/pessimistic_locking_test_sqlserver.rb",
3940
"test/cases/query_cache_test_sqlserver.rb",

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

22
MASTER
33

4+
* Coerce named scope test [Ken Collins]
5+
46
* Change column/view cache to happen at class level. Allows connection pool to share same
57
caches as well as the ability to expire the caches when needed. Also fix change_column so
68
that exceptions are not raised when the column contains an existing default. [Ken Collins]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
require 'cases/sqlserver_helper'
2+
require 'models/company'
3+
4+
class NamedScopeTestSqlserver < ActiveRecord::TestCase
5+
end
6+
7+
class NamedScopeTest < ActiveRecord::TestCase
8+
9+
COERCED_TESTS = [:test_named_scopes_honor_current_scopes_from_when_defined]
10+
11+
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.
18+
assert true
19+
end
20+
21+
22+
end

0 commit comments

Comments
 (0)