Sha256: 7294625e34a425ddb744678d3dcbcd7908d1a28e8d01d0614cb82d687b1112d8
Contents?: true
Size: 1.09 KB
Versions: 75
Compression:
Stored size: 1.09 KB
Contents
require 'test_helper' module SuckerPunch class AsyncSyntaxTest < Minitest::Test def setup require 'sucker_punch/async_syntax' SuckerPunch::Queue.clear end def teardown SuckerPunch::Queue.clear end def test_perform_async_runs_job_asynchronously arr = Concurrent::Array.new latch = Concurrent::CountDownLatch.new FakeLatchJob.new.async.perform(arr, latch) latch.wait(0.2) assert_equal 1, arr.size end def test_perform_async_works_with_keywords arr = Concurrent::Array.new latch = Concurrent::CountDownLatch.new FakeKeywordLatchJob.new.async.perform(arr: arr, latch: latch) latch.wait(0.2) assert_equal 1, arr.size end private class FakeLatchJob include SuckerPunch::Job def perform(arr, latch) arr.push true latch.count_down end end class FakeKeywordLatchJob include SuckerPunch::Job def perform(arr: Concurrent::Array.new, latch: Concurrent::CountDownLatch.new) arr.push true latch.count_down end end end end
Version data entries
75 entries across 75 versions & 2 rubygems