From 0f3aadae3b639ce56dba9c1bcf8a3c3646ccc93b Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Wed, 19 Jun 2013 18:27:13 +0200 Subject: `inspect` for AR model classes does not initiate a new connection. --- activerecord/test/cases/invalid_connection_test.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 activerecord/test/cases/invalid_connection_test.rb (limited to 'activerecord/test') 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 -- cgit v1.2.3