Sha256: 04eb505ca9facc17ddde26a8b5472b62a00d9995b226eb9b61122d33b8954794
Contents?: true
Size: 617 Bytes
Versions: 2
Compression:
Stored size: 617 Bytes
Contents
require 'spec_helper' class GonTestWorker include Gon::ControllerHelpers 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 allow(Gon).to receive(:current_gon).and_call_original 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gon-6.0.1 | spec/gon/thread_spec.rb |
gon-6.0.0 | spec/gon/thread_spec.rb |