blob: 2e5642709d0e0919185a2662a030ed27a4dd5150 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# frozen_string_literal: true
require "bundler/worker"
RSpec.describe Bundler::Worker do
let(:size) { 5 }
let(:name) { "Spec Worker" }
let(:function) { proc {|object, worker_number| [object, worker_number] } }
subject { described_class.new(size, name, function) }
after { subject.stop }
describe "#initialize" do
context "when Thread.start raises ThreadError" do
it "raises when no threads can be created" do
allow(Thread).to receive(:start).and_raise(ThreadError, "error creating thread")
expect { subject.enq "a" }.to raise_error(Bundler::ThreadCreationError, "Failed to create threads for the Spec Worker worker: error creating thread")
end
end
end
end
|