Sha256: 93b7925d18e0fe0e22dd1bc4e038b18ae6aec53fbbe36f623038882ab8b2a543
Contents?: true
Size: 888 Bytes
Versions: 14
Compression:
Stored size: 888 Bytes
Contents
# frozen_string_literal: true # Note that RSpec also provides `uses_transaction` but it needs to be specific # with the name of the method which can easily break and the concurrency tests # will anyways pass when run with the transactional mode. We want the same # database to be used without transactions during the tests so that we can test # concurrency correctly. RSpec.shared_context "with concurrency" do self.use_transactional_tests = false after do # Because the transactional tests are disabled, we need to manually clear # the tables after the test. connection = ActiveRecord::Base.connection connection.disable_referential_integrity do connection.tables.each do |table_name| next if connection.select_value("SELECT COUNT(*) FROM #{table_name}").zero? connection.execute("TRUNCATE #{table_name} CASCADE") end end end end
Version data entries
14 entries across 14 versions & 1 rubygems