diff options
Diffstat (limited to 'spec/bundler/fetcher/compact_index_spec.rb')
-rw-r--r-- | spec/bundler/fetcher/compact_index_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/bundler/fetcher/compact_index_spec.rb b/spec/bundler/fetcher/compact_index_spec.rb index e111d8a3..f6c6ba2e 100644 --- a/spec/bundler/fetcher/compact_index_spec.rb +++ b/spec/bundler/fetcher/compact_index_spec.rb @@ -7,6 +7,10 @@ describe Bundler::Fetcher::CompactIndex do let(:display_uri) { URI("http://sampleuri.com") } let(:compact_index) { described_class.new(downloader, remote, display_uri) } + before do + allow(compact_index).to receive(:log_specs) {} + end + describe "#specs_for_names" do it "has only one thread open at the end of the run" do compact_index.specs_for_names(["lskdjf"]) @@ -20,5 +24,31 @@ describe Bundler::Fetcher::CompactIndex do compact_index.specs_for_names(["lskdjf"]) end + + context "logging" do + before { allow(compact_index).to receive(:log_specs).and_call_original } + + context "with debug on" do + before do + allow(Bundler).to receive_message_chain(:ui, :debug?).and_return(true) + end + + it "should log at info level" do + expect(Bundler).to receive_message_chain(:ui, :debug).with('Looking up gems ["lskdjf"]') + compact_index.specs_for_names(["lskdjf"]) + end + end + + context "with debug off" do + before do + allow(Bundler).to receive_message_chain(:ui, :debug?).and_return(false) + end + + it "should log at info level" do + expect(Bundler).to receive_message_chain(:ui, :info).with(".", false) + compact_index.specs_for_names(["lskdjf"]) + end + end + end end end |