diff options
author | Marcel Molina <marcel@vernix.org> | 2006-01-13 02:04:34 +0000 |
---|---|---|
committer | Marcel Molina <marcel@vernix.org> | 2006-01-13 02:04:34 +0000 |
commit | b98684c3e1ff718569ed02552516f05b03a59f3e (patch) | |
tree | 7e647b41d54cb9c52d68291c1096bceadd81a667 | |
parent | 1e2b3d8b5a37e70134cf4dd05f6ff9e6d19bb0eb (diff) | |
download | rails-b98684c3e1ff718569ed02552516f05b03a59f3e.tar.gz rails-b98684c3e1ff718569ed02552516f05b03a59f3e.tar.bz2 rails-b98684c3e1ff718569ed02552516f05b03a59f3e.zip |
Fix date errors for SQLServer in association tests. Closes #3406.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3404 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | activerecord/CHANGELOG | 4 | ||||
-rwxr-xr-x | activerecord/test/associations_test.rb | 13 |
2 files changed, 8 insertions, 9 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 79557bbf13..447ce724e4 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,6 +1,8 @@ *SVN* -* Escape database name in MySQL adapter when creating and dropping databases. #3409 [anna@wota.jp] +* Fix date errors for SQLServer in association tests. #3406 [kevin.clark@gmal.com] + +r Escape database name in MySQL adapter when creating and dropping databases. #3409 [anna@wota.jp] * Disambiguate table names for columns in validates_uniquness_of's WHERE clause. #3423 [alex.borovsky@gmail.com] diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb index e60035a5ac..b329968f22 100755 --- a/activerecord/test/associations_test.rb +++ b/activerecord/test/associations_test.rb @@ -1188,7 +1188,7 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase # SQL Server doesn't have a separate column type just for dates, # so the time is in the string and incorrectly formatted if current_adapter?(:SQLServerAdapter) - kenReloaded.projects.each { |prj| assert_equal(sqlnow, prj.joined_on.strftime("%Y/%m/%d 00:00:00")) } + kenReloaded.projects.each { |prj| assert_equal(sqlnow, prj.joined_on.to_s) } else kenReloaded.projects.each { |prj| assert_equal(now.to_s, prj.joined_on.to_s) } end @@ -1300,11 +1300,8 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase 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 current_adapter?(: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") - else - assert_equal Date.new(2004, 10, 10).to_s, Developer.find(1).projects.first.joined_on.to_s - end + expected = (current_adapter?(:SQLServerAdapter) ? Time.mktime(2004, 10, 10).strftime("%Y/%m/%d 00:00:00") : Date.new(2004, 10, 10).to_s) + assert_equal expected, Developer.find(1).projects.first.joined_on.to_s end def test_destroy_all @@ -1322,8 +1319,8 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase # SQL Server 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 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"), jamis.projects.select { |p| p.name == projects(:action_controller).name }.first.joined_on.to_s + 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.to_s 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 |