Skip to content

Commit 8b75164

Browse files
deivid-rodriguezmatzbot
authored andcommitted
[rubygems/rubygems] Unify specs testing Bundler.setup failing behavior
They had slightly different behavior in Bundler 2 and Bundler 3 because Bundler 3 will auto-clean after `bundle install`, so one of them system installed gems won't be present when `Bundler.setup` fails. We can unify the specs by moving installing system gems to _after_ `bundle install`, so the behavior in both cases is the same. Also, only this spec actually needs these gems installed, so we can move that from the `before` block to the body of the spec. rubygems/rubygems@b7251ec9c6
1 parent ee7ff4a commit 8b75164

File tree

1 file changed

+3
-32
lines changed

1 file changed

+3
-32
lines changed

spec/bundler/commands/exec_spec.rb

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -723,8 +723,6 @@ def bin_path(a,b,c)
723723
RUBY
724724

725725
before do
726-
system_gems(%w[myrack-1.0.0 myrack-0.9.1], path: default_bundle_path)
727-
728726
bundled_app(path).open("w") {|f| f << executable }
729727
bundled_app(path).chmod(0o755)
730728

@@ -870,38 +868,10 @@ def bin_path(a,b,c)
870868
end
871869
end
872870

873-
context "when Bundler.setup fails", bundler: "< 3" do
871+
context "when Bundler.setup fails" do
874872
before do
875-
gemfile <<-G
876-
source "https://gem.repo1"
877-
gem 'myrack', '2'
878-
G
879-
ENV["BUNDLER_FORCE_TTY"] = "true"
880-
end
881-
882-
let(:exit_code) { Bundler::GemNotFound.new.status_code }
883-
let(:expected) { "" }
884-
let(:expected_err) { <<-EOS.strip }
885-
Could not find gem 'myrack (= 2)' in locally installed gems.
886-
887-
The source contains the following gems matching 'myrack':
888-
* myrack-0.9.1
889-
* myrack-1.0.0
890-
Run `bundle install` to install missing gems.
891-
EOS
892-
893-
it "runs" do
894-
skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
873+
system_gems(%w[myrack-1.0.0 myrack-0.9.1], path: default_bundle_path)
895874

896-
subject
897-
expect(exitstatus).to eq(exit_code)
898-
expect(err).to eq(expected_err)
899-
expect(out).to eq(expected)
900-
end
901-
end
902-
903-
context "when Bundler.setup fails", bundler: "3" do
904-
before do
905875
gemfile <<-G
906876
source "https://gem.repo1"
907877
gem 'myrack', '2'
@@ -915,6 +885,7 @@ def bin_path(a,b,c)
915885
Could not find gem 'myrack (= 2)' in locally installed gems.
916886
917887
The source contains the following gems matching 'myrack':
888+
* myrack-0.9.1
918889
* myrack-1.0.0
919890
Run `bundle install` to install missing gems.
920891
EOS

0 commit comments

Comments
 (0)