diff options
author | claudiob <claudiob@gmail.com> | 2014-11-28 18:55:11 -0800 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-01-04 15:54:21 -0300 |
commit | a856b3dc2cf6715c96d117996994e3eb092eae59 (patch) | |
tree | 611a8e227279b03f570cdd6a80c0559e25685293 /activerecord/test | |
parent | 185d7cdb429764c50fb62035fa918b7ba0a71fae (diff) | |
download | rails-a856b3dc2cf6715c96d117996994e3eb092eae59.tar.gz rails-a856b3dc2cf6715c96d117996994e3eb092eae59.tar.bz2 rails-a856b3dc2cf6715c96d117996994e3eb092eae59.zip |
Remove Thread hack for Ruby 1.9
The hack so skip a Thread test for Ruby 1.9 can be removed now that
Rails requires Ruby >= 2.0.
Conflicts:
activerecord/test/cases/transactions_test.rb
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/transactions_test.rb | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb index e0aecb5996..c4f2ed474d 100644 --- a/activerecord/test/cases/transactions_test.rb +++ b/activerecord/test/cases/transactions_test.rb @@ -503,35 +503,30 @@ class TransactionTest < ActiveRecord::TestCase assert topic.frozen?, 'not frozen' end - # The behavior of killed threads having a status of "aborting" was changed - # in Ruby 2.0, so Thread#kill on 1.9 will prematurely commit the transaction - # and there's nothing we can do about it. - if !RUBY_VERSION.start_with?('1.9') && !in_memory_db? - def test_rollback_when_thread_killed - queue = Queue.new - thread = Thread.new do - Topic.transaction do - @first.approved = true - @second.approved = false - @first.save + def test_rollback_when_thread_killed + queue = Queue.new + thread = Thread.new do + Topic.transaction do + @first.approved = true + @second.approved = false + @first.save - queue.push nil - sleep + queue.push nil + sleep - @second.save - end + @second.save end + end - queue.pop - thread.kill - thread.join + queue.pop + thread.kill + thread.join - assert @first.approved?, "First should still be changed in the objects" - assert !@second.approved?, "Second should still be changed in the objects" + assert @first.approved?, "First should still be changed in the objects" + assert !@second.approved?, "Second should still be changed in the objects" - assert !Topic.find(1).approved?, "First shouldn't have been approved" - assert Topic.find(2).approved?, "Second should still be approved" - end + assert !Topic.find(1).approved?, "First shouldn't have been approved" + assert Topic.find(2).approved?, "Second should still be approved" end def test_restore_active_record_state_for_all_records_in_a_transaction |