DEV: Reduce size of begin-rescue region

DEV: Reduce size of begin-rescue region

Follow-up-to: e3e7905d9ebd86943102917b2ff0bfee32035c01

diff --git a/lib/turbo_tests/runner.rb b/lib/turbo_tests/runner.rb
index 3faff70..808e18a 100644
--- a/lib/turbo_tests/runner.rb
+++ b/lib/turbo_tests/runner.rb
@@ -87,14 +87,15 @@ module TurboTests
 
       ActiveRecord::Tasks::DatabaseTasks.migrations_paths = ['db/migrate', 'db/post_migrate']
 
+      conn = ActiveRecord::Base.establish_connection(config).connection
+
       begin
-        conn = ActiveRecord::Base.establish_connection(config).connection
         ActiveRecord::Migration.check_pending!(conn)
       rescue ActiveRecord::PendingMigrationError
         puts "There are pending migrations, run rake parallel:migrate"
         exit 1
       ensure
-        conn&.close
+        conn.close
       end
     end
 

GitHub sha: 368af327

1 Like