diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2013-06-20 22:47:23 -0700 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2013-06-20 22:47:23 -0700 |
commit | 5ac22989d3f18bd3bf1011ca5ffd0a045e394d2c (patch) | |
tree | 8fb3c5251eb47916fbc3d72e13395d79945875be /activerecord/test/cases | |
parent | 3c0ef057f1af4d39379ba572139aa104c3673779 (diff) | |
parent | 0f3aadae3b639ce56dba9c1bcf8a3c3646ccc93b (diff) | |
download | rails-5ac22989d3f18bd3bf1011ca5ffd0a045e394d2c.tar.gz rails-5ac22989d3f18bd3bf1011ca5ffd0a045e394d2c.tar.bz2 rails-5ac22989d3f18bd3bf1011ca5ffd0a045e394d2c.zip |
Merge pull request #11014 from senny/10936_inspect_does_not_crash_without_connection
`inspect` for AR model classes does not initiate a new connection.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/invalid_connection_test.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/activerecord/test/cases/invalid_connection_test.rb b/activerecord/test/cases/invalid_connection_test.rb new file mode 100644 index 0000000000..f6fe7f0d7d --- /dev/null +++ b/activerecord/test/cases/invalid_connection_test.rb @@ -0,0 +1,20 @@ +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) + end + + test "inspect on Model class does not raise" do + assert_equal "Bird(no database connection)", Bird.inspect + end +end |