summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Metcalfe <git@patrickmetcalfe.com>2015-07-01 14:06:45 -0500
committerPatrick Metcalfe <git@patrickmetcalfe.com>2015-07-01 14:06:45 -0500
commite52d33e695d547525c9391585e2404e5861d8372 (patch)
tree9c270eddc8fd40a3d2a8deb89892cfada3095e5d
parent45a253b502a3983845d711647275b30216d562ae (diff)
downloadbundler-e52d33e695d547525c9391585e2404e5861d8372.tar.gz
spec `#dependencies_installed?`
-rw-r--r--spec/install/parallel/spec_installation_spec.rb40
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..4d59b8a6e8 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