diff options
author | Jon Leighton <j@jonathanleighton.com> | 2013-06-28 11:37:42 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2013-06-28 11:37:42 +0100 |
commit | cb8c95033392f70e1b6566a3c6dc6e033045f0c6 (patch) | |
tree | 347cc010e245bd03d4fa154e4287f3d1c58f1932 /activerecord/test/cases | |
parent | 2ea71837991e40ed8a80f4ce1f6ccb6609891525 (diff) | |
download | rails-cb8c95033392f70e1b6566a3c6dc6e033045f0c6.tar.gz rails-cb8c95033392f70e1b6566a3c6dc6e033045f0c6.tar.bz2 rails-cb8c95033392f70e1b6566a3c6dc6e033045f0c6.zip |
Fix rake test_sqlite3_mem
Clearly nobody uses this except me. It's fast people!
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/disconnected_test.rb | 3 | ||||
-rw-r--r-- | activerecord/test/cases/invalid_connection_test.rb | 15 |
2 files changed, 7 insertions, 11 deletions
diff --git a/activerecord/test/cases/disconnected_test.rb b/activerecord/test/cases/disconnected_test.rb index cc2c1f6489..1fecfd077e 100644 --- a/activerecord/test/cases/disconnected_test.rb +++ b/activerecord/test/cases/disconnected_test.rb @@ -7,13 +7,14 @@ class TestDisconnectedAdapter < ActiveRecord::TestCase self.use_transactional_fixtures = false def setup + skip "in-memory database mustn't disconnect" if in_memory_db? @connection = ActiveRecord::Base.connection end def teardown + return if in_memory_db? spec = ActiveRecord::Base.connection_config ActiveRecord::Base.establish_connection(spec) - @connection = nil end test "can't execute statements while disconnected" do diff --git a/activerecord/test/cases/invalid_connection_test.rb b/activerecord/test/cases/invalid_connection_test.rb index f6fe7f0d7d..567ec59ff4 100644 --- a/activerecord/test/cases/invalid_connection_test.rb +++ b/activerecord/test/cases/invalid_connection_test.rb @@ -1,20 +1,15 @@ require "cases/helper" -require "models/bird" class TestAdapterWithInvalidConnection < ActiveRecord::TestCase self.use_transactional_fixtures = false - def setup - @spec = ActiveRecord::Base.connection_config - non_existing_spec = {adapter: @spec[:adapter], database: "i_do_not_exist"} - ActiveRecord::Base.establish_connection(non_existing_spec) - end - - def teardown - ActiveRecord::Base.establish_connection(@spec) + class Bird < ActiveRecord::Base + # Can't just use current adapter; sqlite3 will create a database + # file on the fly. + establish_connection adapter: 'mysql', database: 'i_do_not_exist' end test "inspect on Model class does not raise" do - assert_equal "Bird(no database connection)", Bird.inspect + assert_equal "#{Bird.name}(no database connection)", Bird.inspect end end |