Skip to content

Commit

Permalink
Remove SQL Server cases from tests for latest adapter work to pass ra…
Browse files Browse the repository at this point in the history
…ils expected behavior.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
  • Loading branch information
metaskills authored and NZKoz committed Nov 19, 2008
1 parent aeae79d commit 8e4624b
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 153 deletions.
6 changes: 2 additions & 4 deletions activerecord/lib/active_record/test_case.rb
Expand Up @@ -3,11 +3,9 @@
module ActiveRecord
class TestCase < ActiveSupport::TestCase #:nodoc:
def assert_date_from_db(expected, actual, message = nil)
# SQL Server doesn't have a separate column type just for dates,
# SybaseAdapter doesn't have a separate column type just for dates,
# so the time is in the string and incorrectly formatted
if current_adapter?(:SQLServerAdapter)
assert_equal expected.strftime("%Y/%m/%d 00:00:00"), actual.strftime("%Y/%m/%d 00:00:00")
elsif current_adapter?(:SybaseAdapter)
if current_adapter?(:SybaseAdapter)
assert_equal expected.to_s, actual.to_date.to_s, message
else
assert_equal expected.to_s, actual.to_s, message
Expand Down
95 changes: 0 additions & 95 deletions activerecord/test/cases/adapter_test_sqlserver.rb

This file was deleted.

2 changes: 1 addition & 1 deletion activerecord/test/cases/associations/eager_test.rb
Expand Up @@ -667,7 +667,7 @@ def test_preconfigured_includes_with_has_many_and_habtm
end

def test_count_with_include
if current_adapter?(:SQLServerAdapter, :SybaseAdapter)
if current_adapter?(:SybaseAdapter)
assert_equal 3, authors(:david).posts_with_comments.count(:conditions => "len(comments.body) > 15")
elsif current_adapter?(:OpenBaseAdapter)
assert_equal 3, authors(:david).posts_with_comments.count(:conditions => "length(FETCHBLOB(comments.body)) > 15")
Expand Down
13 changes: 5 additions & 8 deletions activerecord/test/cases/base_test.rb
Expand Up @@ -428,9 +428,6 @@ def test_non_attribute_access_and_assignment
end

def test_preserving_date_objects
# SQL Server doesn't have a separate column type just for dates, so all are returned as time
return true if current_adapter?(:SQLServerAdapter)

if current_adapter?(:SybaseAdapter, :OracleAdapter)
# Sybase ctlib does not (yet?) support the date type; use datetime instead.
# Oracle treats all dates/times as Time.
Expand Down Expand Up @@ -777,8 +774,8 @@ def test_default_values
end
end

# Oracle, SQLServer, and Sybase do not have a TIME datatype.
unless current_adapter?(:SQLServerAdapter, :OracleAdapter, :SybaseAdapter)
# Oracle, and Sybase do not have a TIME datatype.
unless current_adapter?(:OracleAdapter, :SybaseAdapter)
def test_utc_as_time_zone
Topic.default_timezone = :utc
attributes = { "bonus_time" => "5:42:00AM" }
Expand Down Expand Up @@ -1157,8 +1154,8 @@ def test_multiparameter_assignment_of_aggregation
end

def test_attributes_on_dummy_time
# Oracle, SQL Server, and Sybase do not have a TIME datatype.
return true if current_adapter?(:SQLServerAdapter, :OracleAdapter, :SybaseAdapter)
# Oracle, and Sybase do not have a TIME datatype.
return true if current_adapter?(:OracleAdapter, :SybaseAdapter)

attributes = {
"bonus_time" => "5:42:00AM"
Expand Down Expand Up @@ -1874,7 +1871,7 @@ def test_to_xml
assert_equal "integer", xml.elements["//parent-id"].attributes['type']
assert_equal "true", xml.elements["//parent-id"].attributes['nil']

if current_adapter?(:SybaseAdapter, :SQLServerAdapter, :OracleAdapter)
if current_adapter?(:SybaseAdapter, :OracleAdapter)
assert_equal last_read_in_current_timezone, xml.elements["//last-read"].text
assert_equal "datetime" , xml.elements["//last-read"].attributes['type']
else
Expand Down
6 changes: 1 addition & 5 deletions activerecord/test/cases/binary_test.rb
@@ -1,13 +1,9 @@
require "cases/helper"

# Without using prepared statements, it makes no sense to test
# BLOB data with SQL Server, because the length of a statement is
# limited to 8KB.
#
# Without using prepared statements, it makes no sense to test
# BLOB data with DB2 or Firebird, because the length of a statement
# is limited to 32KB.
unless current_adapter?(:SQLServerAdapter, :SybaseAdapter, :DB2Adapter, :FirebirdAdapter)
unless current_adapter?(:SybaseAdapter, :DB2Adapter, :FirebirdAdapter)
require 'models/binary'

class BinaryTest < ActiveRecord::TestCase
Expand Down
2 changes: 1 addition & 1 deletion activerecord/test/cases/defaults_test.rb
Expand Up @@ -78,7 +78,7 @@ def test_mysql_integer_not_null_defaults
end
end

if current_adapter?(:PostgreSQLAdapter, :SQLServerAdapter, :FirebirdAdapter, :OpenBaseAdapter, :OracleAdapter)
if current_adapter?(:PostgreSQLAdapter, :FirebirdAdapter, :OpenBaseAdapter, :OracleAdapter)
def test_default_integers
default = Default.new
assert_instance_of Fixnum, default.positive_integer
Expand Down
4 changes: 2 additions & 2 deletions activerecord/test/cases/inheritance_test.rb
Expand Up @@ -59,13 +59,13 @@ def test_company_descends_from_active_record

def test_a_bad_type_column
#SQLServer need to turn Identity Insert On before manually inserting into the Identity column
if current_adapter?(:SQLServerAdapter, :SybaseAdapter)
if current_adapter?(:SybaseAdapter)
Company.connection.execute "SET IDENTITY_INSERT companies ON"
end
Company.connection.insert "INSERT INTO companies (id, #{QUOTED_TYPE}, name) VALUES(100, 'bad_class!', 'Not happening')"

#We then need to turn it back Off before continuing.
if current_adapter?(:SQLServerAdapter, :SybaseAdapter)
if current_adapter?(:SybaseAdapter)
Company.connection.execute "SET IDENTITY_INSERT companies OFF"
end
assert_raises(ActiveRecord::SubclassNotFound) { Company.find(100) }
Expand Down
4 changes: 2 additions & 2 deletions activerecord/test/cases/locking_test.rb
Expand Up @@ -200,9 +200,9 @@ def counter_test(model, expected_count)
# blocks, so separate script called by Kernel#system is needed.
# (See exec vs. async_exec in the PostgreSQL adapter.)

# TODO: The SQL Server, Sybase, and OpenBase adapters currently have no support for pessimistic locking
# TODO: The Sybase, and OpenBase adapters currently have no support for pessimistic locking

unless current_adapter?(:SQLServerAdapter, :SybaseAdapter, :OpenBaseAdapter)
unless current_adapter?(:SybaseAdapter, :OpenBaseAdapter)
class PessimisticLockingTest < ActiveRecord::TestCase
self.use_transactional_fixtures = false
fixtures :people, :readers
Expand Down
10 changes: 3 additions & 7 deletions activerecord/test/cases/migration_test.rb
Expand Up @@ -271,9 +271,9 @@ def test_create_table_with_timestamps_should_create_datetime_columns_with_option
Person.connection.drop_table table_name rescue nil
end

# SQL Server, Sybase, and SQLite3 will not allow you to add a NOT NULL
# Sybase, and SQLite3 will not allow you to add a NOT NULL
# column to a table without a default value.
unless current_adapter?(:SQLServerAdapter, :SybaseAdapter, :SQLiteAdapter)
unless current_adapter?(:SybaseAdapter, :SQLiteAdapter)
def test_add_column_not_null_without_default
Person.connection.create_table :testings do |t|
t.column :foo, :string
Expand Down Expand Up @@ -410,7 +410,7 @@ def test_native_types
assert_equal Fixnum, bob.age.class
assert_equal Time, bob.birthday.class

if current_adapter?(:SQLServerAdapter, :OracleAdapter, :SybaseAdapter)
if current_adapter?(:OracleAdapter, :SybaseAdapter)
# Sybase, and Oracle don't differentiate between date/time
assert_equal Time, bob.favorite_day.class
else
Expand Down Expand Up @@ -851,10 +851,6 @@ def test_add_table_with_decimals
# - SQLite3 stores a float, in violation of SQL
assert_kind_of BigDecimal, b.value_of_e
assert_equal BigDecimal("2.71828182845905"), b.value_of_e
elsif current_adapter?(:SQLServer)
# - SQL Server rounds instead of truncating
assert_kind_of Fixnum, b.value_of_e
assert_equal 3, b.value_of_e
else
# - SQL standard is an integer
assert_kind_of Fixnum, b.value_of_e
Expand Down
23 changes: 0 additions & 23 deletions activerecord/test/cases/table_name_test_sqlserver.rb

This file was deleted.

5 changes: 0 additions & 5 deletions activerecord/test/schema/sqlserver_specific_schema.rb

This file was deleted.

2 comments on commit 8e4624b

@gaffo
Copy link
Contributor

@gaffo gaffo commented on 8e4624b Nov 24, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this to disable SQLServer as not working or because the SQLServer adapter got smarter?

@NZKoz
Copy link
Member

@NZKoz NZKoz commented on 8e4624b Nov 24, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was to make SQL Server run all the tests as yes, the adapter got a bunch smarter.

Please sign in to comment.