aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/associations_test.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-10-27 08:18:41 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-10-27 08:18:41 +0000
commitbeff664f2a036c91e266e2ad867f3d1ed8d716c8 (patch)
treea175c7bc0ed6affea55d1595577a2c37e38c74e0 /activerecord/test/associations_test.rb
parentf15819e8f0cece48ccd5117a37cf6d37374d1bb1 (diff)
downloadrails-beff664f2a036c91e266e2ad867f3d1ed8d716c8.tar.gz
rails-beff664f2a036c91e266e2ad867f3d1ed8d716c8.tar.bz2
rails-beff664f2a036c91e266e2ad867f3d1ed8d716c8.zip
Refactor DB exceptions and deal more with DB2 (closes #2624)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2761 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/associations_test.rb')
-rwxr-xr-xactiverecord/test/associations_test.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb
index 70f0eac7ee..6bdafd7868 100755
--- a/activerecord/test/associations_test.rb
+++ b/activerecord/test/associations_test.rb
@@ -1151,7 +1151,7 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase
kenReloaded = Developer.find_by_name 'Ken'
# 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)
+ if current_adapter?(:SQLServerAdapter)
kenReloaded.projects.each { |prj| assert_equal(sqlnow, prj.joined_on.strftime("%Y/%m/%d 00:00:00")) }
else
kenReloaded.projects.each { |prj| assert_equal(now.to_s, prj.joined_on.to_s) }
@@ -1245,7 +1245,7 @@ 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 ActiveRecord::ConnectionAdapters.const_defined? :SQLServerAdapter and ActiveRecord::Base.connection.instance_of?(ActiveRecord::ConnectionAdapters::SQLServerAdapter)
+ if current_adapter?(:SQLServerAdapter)
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
@@ -1266,7 +1266,7 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase
jamis.projects.push_with_attributes(projects(:action_controller), :joined_on => Date.today)
# 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)
+ if current_adapter?(:SQLServerAdapter)
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