Skip to content

Commit a856b3d

Browse files
claudiobrafaelfranca
authored andcommitted
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
1 parent 185d7cd commit a856b3d

File tree

1 file changed

+18
-23
lines changed

1 file changed

+18
-23
lines changed

activerecord/test/cases/transactions_test.rb

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -503,35 +503,30 @@ def test_rollback_when_saving_a_frozen_record
503503
assert topic.frozen?, 'not frozen'
504504
end
505505

506-
# The behavior of killed threads having a status of "aborting" was changed
507-
# in Ruby 2.0, so Thread#kill on 1.9 will prematurely commit the transaction
508-
# and there's nothing we can do about it.
509-
if !RUBY_VERSION.start_with?('1.9') && !in_memory_db?
510-
def test_rollback_when_thread_killed
511-
queue = Queue.new
512-
thread = Thread.new do
513-
Topic.transaction do
514-
@first.approved = true
515-
@second.approved = false
516-
@first.save
506+
def test_rollback_when_thread_killed
507+
queue = Queue.new
508+
thread = Thread.new do
509+
Topic.transaction do
510+
@first.approved = true
511+
@second.approved = false
512+
@first.save
517513

518-
queue.push nil
519-
sleep
514+
queue.push nil
515+
sleep
520516

521-
@second.save
522-
end
517+
@second.save
523518
end
519+
end
524520

525-
queue.pop
526-
thread.kill
527-
thread.join
521+
queue.pop
522+
thread.kill
523+
thread.join
528524

529-
assert @first.approved?, "First should still be changed in the objects"
530-
assert !@second.approved?, "Second should still be changed in the objects"
525+
assert @first.approved?, "First should still be changed in the objects"
526+
assert !@second.approved?, "Second should still be changed in the objects"
531527

532-
assert !Topic.find(1).approved?, "First shouldn't have been approved"
533-
assert Topic.find(2).approved?, "Second should still be approved"
534-
end
528+
assert !Topic.find(1).approved?, "First shouldn't have been approved"
529+
assert Topic.find(2).approved?, "Second should still be approved"
535530
end
536531

537532
def test_restore_active_record_state_for_all_records_in_a_transaction

0 commit comments

Comments
 (0)