Sha256: 19e14799742af7aac9c7cca8751208e615c7cb1c1e35c854f156b937bde9efd0

Contents?: true

Size: 594 Bytes

Versions: 1

Compression:

Stored size: 594 Bytes

Contents

require 'test_helper'

class ThreadSafetyTest < ActionController::TestCase
  test "be thread safe" do
    blocked = true

    slow_thread = Thread.new do
      controller = TestController.new
      controller.send :set_paper_trail_whodunnit
      begin
        sleep 0.001
      end while blocked
      PaperTrail.whodunnit
    end

    fast_thread = Thread.new do
      controller = TestController.new
      controller.send :set_paper_trail_whodunnit
      who = PaperTrail.whodunnit
      blocked = false
      who
    end

    assert_not_equal slow_thread.value, fast_thread.value
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
paper_trail-3.0.0 test/functional/thread_safety_test.rb