Sha256: 5838ff58a0c068d0a135016517a8c31c9a573484b7826f0f874d5a662f9cd629
Contents?: true
Size: 753 Bytes
Versions: 1
Compression:
Stored size: 753 Bytes
Contents
require 'test/unit' require 'thread_local_accessor' # http://coderrr.wordpress.com/2008/04/10/lets-stop-polluting-the-threadcurrent-hash/ class ThreadedLib thread_local_accessor :some_setting, :default => :default end class TestThreadedClassAttrAccessor < Test::Unit::TestCase def test_that_it_works! instance = ThreadedLib.new ThreadedLib.some_setting = 5 assert_equal 5, ThreadedLib.some_setting assert_equal 5, instance.some_setting Thread.new { instance.some_setting = 10 assert_equal 10, ThreadedLib.some_setting assert_equal 10, instance.some_setting }.join Thread.new { assert_equal :default, ThreadedLib.some_setting }.join assert_equal 5, ThreadedLib.some_setting end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
thread_local_accessor-0.1.0 | test/thread_local_accessor_test.rb |