diff options
-rw-r--r-- | lib/bundler/cli/pristine.rb | 2 | ||||
-rw-r--r-- | spec/commands/pristine_spec.rb | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/bundler/cli/pristine.rb b/lib/bundler/cli/pristine.rb index ccf970eae0..cfd90da34b 100644 --- a/lib/bundler/cli/pristine.rb +++ b/lib/bundler/cli/pristine.rb @@ -8,6 +8,8 @@ module Bundler end def run + CLI::Common.ensure_all_gems_in_lockfile!(@gems) + Bundler.load.specs.each do |spec| next if spec.name == "bundler" # Source::Rubygems doesn't install bundler next if !@gems.empty? && !@gems.include?(spec.name) diff --git a/spec/commands/pristine_spec.rb b/spec/commands/pristine_spec.rb index 5b9dffce98..9c3918f51e 100644 --- a/spec/commands/pristine_spec.rb +++ b/spec/commands/pristine_spec.rb @@ -128,16 +128,21 @@ RSpec.describe "bundle pristine" do FileUtils.touch(weakling_changes_txt) expect(weakling_changes_txt).to be_file - bundle! "pristine foo bar weakling bundler" + bundle! "pristine foo bar weakling" expect(out).to eq(strip_whitespace(<<-EOS).strip) - Installing weakling 1.0 - Using foo 1.0 from #{lib_path("foo")} (at master@#{foo_ref}) Cannot pristine bar (1.0). Gem is sourced from local path. + Using foo 1.0 from #{lib_path("foo")} (at master@#{foo_ref}) + Installing weakling 1.0 EOS expect(weakling_changes_txt).not_to be_file expect(foo_changes_txt).not_to be_file expect(bar_changes_txt).to be_file end + + it "raises when one of them is not in the lockfile" do + bundle "pristine abcabcabc" + expect(out).to include("Could not find gem 'abcabcabc'.") + end end end |