Permalink
Browse files

Fixed a few sqlserver test case errors. Closes #2486

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2666 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent cb8bb70 commit 2a1a0e52751dc174c39a24bbca6b7bf4b75b10c5 Tobias Lütke committed Oct 17, 2005
Showing with 13 additions and 7 deletions.
  1. +3 −3 activerecord/test/associations_test.rb
  2. +6 −4 activerecord/test/base_test.rb
  3. +4 −0 activerecord/test/binary_test.rb
@@ -1221,7 +1221,7 @@ def test_additional_columns_from_join_table
# SQL Server doesn't have a separate column type just for dates,
# so the time is in the string and incorrectly formatted
if ActiveRecord::ConnectionAdapters.const_defined? :SQLServerAdapter and ActiveRecord::Base.connection.instance_of?(ActiveRecord::ConnectionAdapters::SQLServerAdapter)
- assert_equal Time.mktime(2004, 10, 10).strftime("%Y/%m/%d 00:00:00"), Developer.find(1).projects.first.joined_on.strftime("%Y/%m/%d 00:00:00")
+ assert_equal Time.mktime(2004, 10, 10).strftime("%Y/%m/%d 00:00:00"), Time.parse(Developer.find(1).projects.first.joined_on).strftime("%Y/%m/%d 00:00:00")
else
assert_equal Date.new(2004, 10, 10).to_s, Developer.find(1).projects.first.joined_on.to_s
end
@@ -1242,8 +1242,8 @@ def test_rich_association
# SQL Server doesn't have a separate column type just for dates,
# so the time is in the string and incorrectly formatted
if ActiveRecord::ConnectionAdapters.const_defined? :SQLServerAdapter and ActiveRecord::Base.connection.instance_of?(ActiveRecord::ConnectionAdapters::SQLServerAdapter)
- assert_equal Time.now.strftime("%Y/%m/%d 00:00:00"), jamis.projects.select { |p| p.name == projects(:action_controller).name }.first.joined_on.strftime("%Y/%m/%d 00:00:00")
- assert_equal Time.now.strftime("%Y/%m/%d 00:00:00"), developers(:jamis).projects.select { |p| p.name == projects(:action_controller).name }.first.joined_on.strftime("%Y/%m/%d 00:00:00")
+ assert_equal Time.now.strftime("%Y/%m/%d 00:00:00"), Time.parse(jamis.projects.select { |p| p.name == projects(:action_controller).name }.first.joined_on).strftime("%Y/%m/%d 00:00:00")
+ assert_equal Time.now.strftime("%Y/%m/%d 00:00:00"), Time.parse(developers(:jamis).projects.select { |p| p.name == projects(:action_controller).name }.first.joined_on).strftime("%Y/%m/%d 00:00:00")
else
assert_equal Date.today.to_s, jamis.projects.select { |p| p.name == projects(:action_controller).name }.first.joined_on.to_s
assert_equal Date.today.to_s, developers(:jamis).projects.select { |p| p.name == projects(:action_controller).name }.first.joined_on.to_s
@@ -1,5 +1,3 @@
-require 'abstract_unit'
-require 'fixtures/topic'
require 'fixtures/reply'
require 'fixtures/company'
require 'fixtures/developer'
@@ -464,8 +462,8 @@ def test_default_values
assert_nil topic.last_read
end
- # Oracle does not have a TIME datatype.
- unless 'OCI' == ActiveRecord::Base.connection.adapter_name
+ # Oracle and SQLServer do not have a TIME datatype.
+ unless 'OCI' == ActiveRecord::Base.connection.adapter_name or ActiveRecord::ConnectionAdapters.const_defined?(:SQLServerAdapter)
def test_utc_as_time_zone
Topic.default_timezone = :utc
attributes = { "bonus_time" => "5:42:00AM" }
@@ -643,6 +641,10 @@ def test_attributes_on_dummy_time
if ActiveRecord::ConnectionAdapters.const_defined? :OracleAdapter
return true if ActiveRecord::Base.connection.instance_of?(ActiveRecord::ConnectionAdapters::OracleAdapter)
end
+ # Sqlserver doesn't either .
+ if ActiveRecord::ConnectionAdapters.const_defined? :SQLServerAdapter
+ return true if ActiveRecord::Base.connection.instance_of?(ActiveRecord::ConnectionAdapters::SQLServerAdapter)
+ end
attributes = {
"bonus_time" => "5:42:00AM"
@@ -8,6 +8,10 @@ def setup
Binary.connection.execute 'DELETE FROM binaries'
@data = File.read(BINARY_FIXTURE_PATH).freeze
end
+
+ def test_truth
+ assert true
+ end
# Without using prepared statements, it makes no sense to test
# BLOB data with SQL Server, because the length of a statement is

0 comments on commit 2a1a0e5

Please sign in to comment.