diff options
author | André Arko <mail@arko.net> | 2015-07-01 22:12:06 -0700 |
---|---|---|
committer | André Arko <mail@arko.net> | 2015-07-01 22:12:06 -0700 |
commit | fafd671635036cb74c4bb28e3c1d25ce63a9d400 (patch) | |
tree | 9b05d66eceb04473b2400836e0b1b832a39dc8f4 /spec | |
parent | d8c5e53b6e3115498e67b06158b42d59905a417e (diff) | |
parent | 8cc6a7d5aaa5e3097eb7eac101df134f8d068a10 (diff) | |
download | bundler-fafd671635036cb74c4bb28e3c1d25ce63a9d400.tar.gz |
Merge pull request #3800 from pducks32/wrong-order-parallel-installer
switch reject to select
Diffstat (limited to 'spec')
-rw-r--r-- | spec/install/parallel/spec_installation_spec.rb | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/spec/install/parallel/spec_installation_spec.rb b/spec/install/parallel/spec_installation_spec.rb index 97288fe02f..8cb6ea8a49 100644 --- a/spec/install/parallel/spec_installation_spec.rb +++ b/spec/install/parallel/spec_installation_spec.rb @@ -2,16 +2,16 @@ require 'spec_helper' require 'bundler/installer/parallel_installer' describe ParallelInstaller::SpecInstallation do - describe "#ready_to_enqueue?" do - let!(:dep) do - a_spec = Object.new - def a_spec.name - "I like tests" - end - a_spec + let!(:dep) do + a_spec = Object.new + def a_spec.name + "I like tests" end + a_spec + end + describe "#ready_to_enqueue?" do context "when in enqueued state" do it "is falsey" do spec = ParallelInstaller::SpecInstallation.new(dep) @@ -34,4 +34,30 @@ describe ParallelInstaller::SpecInstallation do end end + describe "#dependencies_installed?" do + context "when all dependencies are installed" do + it "returns true" do + dependencies = [] + dependencies << instance_double("SpecInstallation", :spec => "alpha", :name => "alpha", :installed? => true, :all_dependencies => [], :type => :production) + dependencies << instance_double("SpecInstallation", :spec => "beta", :name => "beta", :installed? => true, :all_dependencies => [], :type => :production) + all_specs = dependencies + [instance_double("SpecInstallation", :spec => "gamma", :name => "gamma", :installed? => false, :all_dependencies => [], :type => :production)] + spec = ParallelInstaller::SpecInstallation.new(dep) + allow(spec).to receive(:all_dependencies).and_return(dependencies) + expect(spec.dependencies_installed?(all_specs)).to be_truthy + end + end + + context "when all dependencies are not installed" do + it "returns false" do + dependencies = [] + dependencies << instance_double("SpecInstallation", :spec => "alpha", :name => "alpha", :installed? => false, :all_dependencies => [], :type => :production) + dependencies << instance_double("SpecInstallation", :spec => "beta", :name => "beta", :installed? => true, :all_dependencies => [], :type => :production) + all_specs = dependencies + [instance_double("SpecInstallation", :spec => "gamma", :name => "gamma", :installed? => false, :all_dependencies => [], :type => :production)] + spec = ParallelInstaller::SpecInstallation.new(dep) + allow(spec).to receive(:all_dependencies).and_return(dependencies) + expect(spec.dependencies_installed?(all_specs)).to be_falsey + end + end + end + end |