Skip to content

Commit

Permalink
Coercing a few more tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
metaskills committed Dec 1, 2009
1 parent 4449d6e commit 4afee37
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
1 change: 1 addition & 0 deletions 2000-2005-adapter.gemspec
Expand Up @@ -44,6 +44,7 @@ Gem::Specification.new do |s|
"test/cases/table_name_test_sqlserver.rb",
"test/cases/transaction_test_sqlserver.rb",
"test/cases/unicode_test_sqlserver.rb",
"test/cases/validations_test_sqlserver.rb",
"test/connections/native_sqlserver/connection.rb",
"test/connections/native_sqlserver_odbc/connection.rb",
"test/migrations/transaction_table/1_table_will_never_be_created.rb",
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG
@@ -1,7 +1,7 @@

MASTER

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

* Change column/view cache to happen at class level. Allows connection pool to share same
caches as well as the ability to expire the caches when needed. Also fix change_column so
Expand Down
13 changes: 6 additions & 7 deletions test/cases/named_scope_test_sqlserver.rb
@@ -1,5 +1,4 @@
require 'cases/sqlserver_helper'
require 'models/company'

class NamedScopeTestSqlserver < ActiveRecord::TestCase
end
Expand All @@ -9,12 +8,12 @@ class NamedScopeTest < ActiveRecord::TestCase
COERCED_TESTS = [:test_named_scopes_honor_current_scopes_from_when_defined]

include SqlserverCoercedTest
def test_named_scopes_honor_current_scopes_from_when_defined
# http://github.com/rails/rails/commit/0dd2f96f5c90f8abacb0fe0757ef7e5db4a4d501#comment_37025
# The orig test is a little brittle and fails on other adapters that do not explicitly fall back to a secondary
# sort of id ASC. Since there are duplicate records with comments_count equal to one another. I have found that
# named_scope :ranked_by_comments, :order => "comments_count DESC, id ASC" fixes the ambiguity.

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

Expand Down
24 changes: 24 additions & 0 deletions test/cases/validations_test_sqlserver.rb
@@ -0,0 +1,24 @@
require 'cases/sqlserver_helper'

class ValidationsTestSqlserver < ActiveRecord::TestCase
end

class ValidationsTest < ActiveRecord::TestCase

COERCED_TESTS = [:test_validate_uniqueness_with_limit_and_utf8]

include SqlserverCoercedTest

# Because SQL Server converts UTF8 data to some other data type, there is no such thing as a
# one to byte length check. See this article for details:
# http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=362867
#
# Had the idea of doing this, but could not since the above was true.
# Event.connection.change_column :events, :title, :nvarchar, :limit => 5
# Event.reset_column_information
def test_coerced_test_validate_uniqueness_with_limit_and_utf8
assert true
end

end

0 comments on commit 4afee37

Please sign in to comment.