2013-06-19 12:27:13 -04:00
|
|
|
require "cases/helper"
|
|
|
|
|
|
|
|
class TestAdapterWithInvalidConnection < ActiveRecord::TestCase
|
2015-03-10 22:21:19 -04:00
|
|
|
self.use_transactional_tests = false
|
2013-06-19 12:27:13 -04:00
|
|
|
|
2013-06-28 06:37:42 -04:00
|
|
|
class Bird < ActiveRecord::Base
|
2013-06-28 06:46:03 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def setup
|
2013-06-28 06:37:42 -04:00
|
|
|
# Can't just use current adapter; sqlite3 will create a database
|
|
|
|
# file on the fly.
|
2013-06-28 06:46:03 -04:00
|
|
|
Bird.establish_connection adapter: 'mysql', database: 'i_do_not_exist'
|
|
|
|
end
|
|
|
|
|
2014-03-14 00:35:58 -04:00
|
|
|
teardown do
|
2013-06-28 06:46:03 -04:00
|
|
|
Bird.remove_connection
|
2013-06-19 12:27:13 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
test "inspect on Model class does not raise" do
|
2013-11-09 07:13:15 -05:00
|
|
|
assert_equal "#{Bird.name} (call '#{Bird.name}.connection' to establish a connection)", Bird.inspect
|
2013-06-19 12:27:13 -04:00
|
|
|
end
|
|
|
|
end
|