Sha256: 20f78dc97839049809dbf8271d037925a1eda7c8c6ce94ef214b7ed58c480c68
Contents?: true
Size: 925 Bytes
Versions: 8
Compression:
Stored size: 925 Bytes
Contents
# frozen_string_literal: true require_relative "../../spec_helper" require_relative "../../../lib/ultravisor/child" require_relative "../../../lib/ultravisor/error" describe Ultravisor::Child do let(:args) { { id: :bob, klass: mock_class, method: :run } } let(:child) { Ultravisor::Child.new(**args) } let(:mock_class) { Class.new.tap { |k| k.class_eval { def run; end } } } describe "#wait" do context "when the child isn't running" do it "just returns straight away" do child.wait end end context "when the child is running" do it "only exits once the child has finished" do child.instance_variable_set(:@thread, Thread.new {}) expect(child.instance_variable_get(:@spawn_cv)).to receive(:wait).with(child.instance_variable_get(:@spawn_m)) do child.instance_variable_set(:@thread, nil) end child.wait end end end end
Version data entries
8 entries across 8 versions & 1 rubygems