diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-10-27 08:18:41 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-10-27 08:18:41 +0000 |
commit | beff664f2a036c91e266e2ad867f3d1ed8d716c8 (patch) | |
tree | a175c7bc0ed6affea55d1595577a2c37e38c74e0 /activerecord/test/inheritance_test.rb | |
parent | f15819e8f0cece48ccd5117a37cf6d37374d1bb1 (diff) | |
download | rails-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/inheritance_test.rb')
-rwxr-xr-x | activerecord/test/inheritance_test.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/test/inheritance_test.rb b/activerecord/test/inheritance_test.rb index a3b9ce25ad..432aee7e0e 100755 --- a/activerecord/test/inheritance_test.rb +++ b/activerecord/test/inheritance_test.rb @@ -8,12 +8,13 @@ class InheritanceTest < Test::Unit::TestCase def test_a_bad_type_column #SQLServer need to turn Identity Insert On before manually inserting into the Identity column - if ActiveRecord::ConnectionAdapters.const_defined? :SQLServerAdapter and ActiveRecord::Base.connection.instance_of?(ActiveRecord::ConnectionAdapters::SQLServerAdapter) + if current_adapter?(:SQLServerAdapter) Company.connection.execute "SET IDENTITY_INSERT companies ON" end Company.connection.insert "INSERT INTO companies (id, type, name) VALUES(100, 'bad_class!', 'Not happening')" + #We then need to turn it back Off before continuing. - if ActiveRecord::ConnectionAdapters.const_defined? :SQLServerAdapter and ActiveRecord::Base.connection.instance_of?(ActiveRecord::ConnectionAdapters::SQLServerAdapter) + if current_adapter?(:SQLServerAdapter) Company.connection.execute "SET IDENTITY_INSERT companies OFF" end assert_raises(ActiveRecord::SubclassNotFound) { Company.find(100) } |