summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Johnston <wjohnston@mpr.org>2016-05-24 13:41:38 -0500
committerWilliam Johnston <wjohnston@mpr.org>2016-05-24 13:41:38 -0500
commitb01b5f9ac94a9d0ba1df86ad077582fc1df942d2 (patch)
tree083e1c4e22e8e020ddea3545340b2b3f938be7b3
parent176a21a5580feee04bfb088b236824f14435bad5 (diff)
downloadbundler-b01b5f9ac94a9d0ba1df86ad077582fc1df942d2.tar.gz
Add test for thread issue
-rw-r--r--spec/bundler/fetcher/compact_index_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/bundler/fetcher/compact_index_spec.rb b/spec/bundler/fetcher/compact_index_spec.rb
new file mode 100644
index 0000000000..9b480f6b11
--- /dev/null
+++ b/spec/bundler/fetcher/compact_index_spec.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+require "spec_helper"
+
+describe Bundler::Fetcher::CompactIndex do
+ let(:downloader) { double(:downloader) }
+ let(:remote) { double(:remote, :cache_slug => "lsjdf") }
+ let(:display_uri) { URI("http://sample_uri.com") }
+ let(:compact_index) { described_class.new(downloader, remote, display_uri) }
+
+ # Testing private method. Do not commit.
+ describe '#specs_for_names' do
+ it "has only one thread open at the end of the run" do
+ compact_index.specs_for_names(['lskdjf'])
+
+ thread_count = Thread.list.select {|thread| thread.status == "run" }.count
+ expect(thread_count).to eq 1
+ end
+
+ it "calls worker#stop during the run" do
+ expect_any_instance_of(Bundler::Worker).to receive(:stop).at_least(:once)
+
+ compact_index.specs_for_names(['lskdjf'])
+ end
+ end
+end