diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-11-08 20:50:36 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-08 20:50:36 -0500 |
commit | 37239710d1e67af552d339a244155a99706e8779 (patch) | |
tree | fdc8c4d2818c4681d549cff4f7f67f847cc36605 /activerecord | |
parent | 7b766bd8712610b767fb0db3e25f78a375a48f9e (diff) | |
parent | 801fbde87deae5c01c581a6e4ef1157d27185b32 (diff) | |
download | rails-37239710d1e67af552d339a244155a99706e8779.tar.gz rails-37239710d1e67af552d339a244155a99706e8779.tar.bz2 rails-37239710d1e67af552d339a244155a99706e8779.zip |
Merge pull request #31091 from yahonda/concurrent_transaction_test_conditions
Allow `ConcurrentTransactionTest` can run with Oracle enhanced adapter
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/transactions_test.rb | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb index 91032945a6..5c8ae4d3cb 100644 --- a/activerecord/test/cases/transactions_test.rb +++ b/activerecord/test/cases/transactions_test.rb @@ -954,27 +954,25 @@ class TransactionsWithTransactionalFixturesTest < ActiveRecord::TestCase end end if Topic.connection.supports_savepoints? -if current_adapter?(:PostgreSQLAdapter, :Mysql2Adapter) +if ActiveRecord::Base.connection.supports_transaction_isolation? class ConcurrentTransactionTest < TransactionTest # This will cause transactions to overlap and fail unless they are performed on # separate database connections. - unless in_memory_db? - def test_transaction_per_thread - threads = 3.times.map do - Thread.new do - Topic.transaction do - topic = Topic.find(1) - topic.approved = !topic.approved? - assert topic.save! - topic.approved = !topic.approved? - assert topic.save! - end - Topic.connection.close + def test_transaction_per_thread + threads = 3.times.map do + Thread.new do + Topic.transaction do + topic = Topic.find(1) + topic.approved = !topic.approved? + assert topic.save! + topic.approved = !topic.approved? + assert topic.save! end + Topic.connection.close end - - threads.each(&:join) end + + threads.each(&:join) end # Test for dirty reads among simultaneous transactions. |