DEV: Multisite tests didn't fail anymore

DEV: Multisite tests didn’t fail anymore

The change in 9ba8bfb1aaa46e97874c2d262d561a27750ae1ee swallowed all exceptions (even syntax errors) which made them appear to pass even if they failed.

diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index a2e2202..cc0f80b 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -210,13 +210,18 @@ RSpec.configure do |config|
   # force a rollback after using a multisite connection.
   def test_multisite_connection(name)
     RailsMultisite::ConnectionManagement.with_connection(name) do
+      spec_exception = nil
+
       ActiveRecord::Base.transaction do
         begin
           yield
+        rescue Exception => spec_exception
         ensure
-          throw raise ActiveRecord::Rollback
+          raise ActiveRecord::Rollback
         end
       end
+
+      raise spec_exception if spec_exception
     end
   end

GitHub sha: 7e9da812

2 Likes

Fix specs

Oops, sorry about that!

2 Likes

Also, this exposed another heisentest:

3 Likes