|
297 | 297 | let(:sources) { Bundler::SourceList.new } |
298 | 298 | subject { Bundler::Definition.new(nil, [], sources, []) } |
299 | 299 |
|
300 | | - context "when remote and does not have multiple global sources" do |
301 | | - before do |
302 | | - subject.instance_variable_set(:@remote, true) |
303 | | - allow(sources).to receive(:aggregate_global_source?).and_return(false) |
304 | | - allow(sources).to receive(:non_global_rubygems_sources).and_return(non_global_rubygems_sources) |
305 | | - end |
| 300 | + before do |
| 301 | + allow(sources).to receive(:non_global_rubygems_sources).and_return(non_global_rubygems_sources) |
| 302 | + end |
306 | 303 |
|
307 | | - context "when all the scoped sources contain a dependency API" do |
308 | | - let(:non_global_rubygems_sources) do |
309 | | - [ |
310 | | - double("non-global-source-0", :dependency_api_available? => true, :to_s => "a"), |
311 | | - double("non-global-source-1", :dependency_api_available? => true, :to_s => "b"), |
312 | | - ] |
313 | | - end |
| 304 | + context "when all the scoped sources implement a dependency API" do |
| 305 | + let(:non_global_rubygems_sources) do |
| 306 | + [ |
| 307 | + double("non-global-source-0", :dependency_api_available? => true, :to_s => "a"), |
| 308 | + double("non-global-source-1", :dependency_api_available? => true, :to_s => "b"), |
| 309 | + ] |
| 310 | + end |
314 | 311 |
|
315 | | - it "will not raise a warning" do |
316 | | - expect(subject).not_to receive(:non_dependency_api_warning) |
| 312 | + it "returns true without warning" do |
| 313 | + expect(subject).not_to receive(:non_dependency_api_warning) |
317 | 314 |
|
318 | | - expect(subject.send(:precompute_source_requirements_for_indirect_dependencies?)).to be_truthy |
319 | | - end |
| 315 | + expect(subject.send(:precompute_source_requirements_for_indirect_dependencies?)).to be_truthy |
320 | 316 | end |
| 317 | + end |
321 | 318 |
|
322 | | - context "when scoped sources do not contain a dependency API" do |
323 | | - let(:non_global_rubygems_sources) do |
324 | | - [ |
325 | | - double("non-global-source-0", :dependency_api_available? => true, :to_s => "a"), |
326 | | - double("non-global-source-1", :dependency_api_available? => false, :to_s => "b"), |
327 | | - double("non-global-source-2", :dependency_api_available? => false, :to_s => "c"), |
328 | | - ] |
329 | | - end |
| 319 | + context "when some scoped sources do not implement a dependency API" do |
| 320 | + let(:non_global_rubygems_sources) do |
| 321 | + [ |
| 322 | + double("non-global-source-0", :dependency_api_available? => true, :to_s => "a"), |
| 323 | + double("non-global-source-1", :dependency_api_available? => false, :to_s => "b"), |
| 324 | + double("non-global-source-2", :dependency_api_available? => false, :to_s => "c"), |
| 325 | + ] |
| 326 | + end |
330 | 327 |
|
331 | | - it "will raise a warning" do |
332 | | - expect(Bundler.ui).to receive(:warn).with(<<-W.strip) |
| 328 | + it "returns false and warns about the non-API sources" do |
| 329 | + expect(Bundler.ui).to receive(:warn).with(<<-W.strip) |
333 | 330 | Your Gemfile contains scoped sources that don't implement a dependency API, namely: |
334 | 331 |
|
335 | 332 | * b |
336 | 333 | * c |
337 | 334 |
|
338 | 335 | Using the above gem servers may result in installing unexpected gems. To resolve this warning, make sure you use gem servers that implement dependency APIs, such as gemstash or geminabox gem servers. |
339 | | - W |
| 336 | + W |
340 | 337 |
|
341 | | - expect(subject.send(:precompute_source_requirements_for_indirect_dependencies?)).to be_falsy |
342 | | - end |
| 338 | + expect(subject.send(:precompute_source_requirements_for_indirect_dependencies?)).to be_falsy |
343 | 339 | end |
344 | 340 | end |
345 | 341 | end |
|
0 commit comments