提交 cb8c9503 编写于 作者: J Jon Leighton

Fix rake test_sqlite3_mem

Clearly nobody uses this except me. It's fast people!
上级 2ea71837
......@@ -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
......
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册