lib/slavery.rb in slavery-1.0.1 vs lib/slavery.rb in slavery-1.1.0

- old
+ new

@@ -60,10 +60,13 @@ master_connection end end def slaveryable? - inside_transaction = master_connection.open_transactions > 0 + base_transaction_depth = defined?(ActiveSupport::TestCase) && + ActiveSupport::TestCase.respond_to?(:use_transactional_fixtures) && + ActiveSupport::TestCase.try(:use_transactional_fixtures) ? 1 : 0 + inside_transaction = master_connection.open_transactions > base_transaction_depth raise Error.new('on_slave cannot be used inside transaction block!') if inside_transaction !Slavery.disabled end