Sha256: 6bbb5c7543f8d1654c24b23d8261cf480cdd040013cf3dd53e7d4278d5f69345
Contents?: true
Size: 1.05 KB
Versions: 18
Compression:
Stored size: 1.05 KB
Contents
# -*- Encoding: utf-8 -*- # # Copyright 2013 whiteleaf. All rights reserved. # module Narou end require_relative "../lib/web/worker" describe Narou::Worker do before :all do @worker = Narou::Worker.instance end it "instance is a singleton object" do expect(@worker).to be Narou::Worker.instance end context "not running yet" do it do expect(@worker.running?).to be false end end context "alrady running" do before do @worker.start end it do expect(@worker.running?).to be true end context "when pushing blocks" do before do @result1 = false @result2 = false block1 = -> { @result1 = true } block2 = -> { @result2 = true } @worker.push(&block1) @worker.push(&block2) end it do Thread.pass # 確実にWorkerスレッドが実行されるように expect(@result1).to be true expect(@result2).to be true end end it do @worker.stop expect(@worker.running?).to be false end end end
Version data entries
18 entries across 18 versions & 1 rubygems