Sha256: f98c300e09bd0dc00412c6c0d654abc2c7db2f88a55bdf2d19bd62bc74e1c2a7
Contents?: true
Size: 581 Bytes
Versions: 5
Compression:
Stored size: 581 Bytes
Contents
require 'spec_helper' class GonTestWorker include Gon::GonHelpers def request @request ||= ActionDispatch::TestRequest.new end def env request.env end def execute gon.clear gon.a ||= 1 gon.a += 1 end def value gon.a end end describe 'threading behaviour' do before do Gon.unstub(:current_gon) end it 'is threadsafe' do threads = [] 10.times do threads << Thread.new do gtw = GonTestWorker.new gtw.execute expect(gtw.value).to eq 2 end end threads.each(&:join) end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
gon-5.1.1 | spec/gon/thread_spec.rb |
gon-5.1.0 | spec/gon/thread_spec.rb |
gon-5.0.4 | spec/gon/thread_spec.rb |
gon-5.0.3 | spec/gon/thread_spec.rb |
gon-5.0.2 | spec/gon/thread_spec.rb |