summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2025-06-05 10:53:06 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2025-06-06 10:09:14 +0900
commit3b2d068ac2250fae91bd4b433b8ce393615ddc86 (patch)
tree533686209e4c4da17496898b668690347e9129b2
parentd95f7a3c43fb2014e5865ab6bc01dd4ac6d26c79 (diff)
[rubygems/rubygems] Improve `bundle exec` with default gems specs
Make them more consistent and not silently pass even if something regresses. These specs had a typo that made the assertion be that the `erb --version` output includes the empty string which is always obviously true. https://github.com/rubygems/rubygems/commit/451e07c305
-rw-r--r--spec/bundler/commands/exec_spec.rb19
1 files changed, 10 insertions, 9 deletions
diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb
index 62421410ed..ec8f4c5b89 100644
--- a/spec/bundler/commands/exec_spec.rb
+++ b/spec/bundler/commands/exec_spec.rb
@@ -193,7 +193,10 @@ RSpec.describe "bundle exec" do
end
context "with default gems" do
- let(:default_erb_version) { ruby "gem 'erb', '< 999999'; require 'erb/version'; puts Erb::VERSION", raise_on_error: false }
+ # TODO: Switch to ERB::VERSION once Ruby 3.4 support is dropped, so all
+ # supported rubies include an `erb` gem version where `ERB::VERSION` is
+ # public
+ let(:default_erb_version) { ruby "require 'erb/version'; puts ERB.const_get(:VERSION)" }
context "when not specified in Gemfile" do
before do
@@ -201,9 +204,9 @@ RSpec.describe "bundle exec" do
end
it "uses version provided by ruby" do
- bundle "exec erb --version"
+ bundle "exec erb --version", artifice: nil
- expect(out).to include(default_erb_version)
+ expect(stdboth).to eq(default_erb_version)
end
end
@@ -226,8 +229,7 @@ RSpec.describe "bundle exec" do
it "uses version specified" do
bundle "exec erb --version", artifice: nil
- expect(out).to eq(specified_erb_version)
- expect(err).to be_empty
+ expect(stdboth).to eq(specified_erb_version)
end
end
@@ -249,13 +251,12 @@ RSpec.describe "bundle exec" do
source "https://gem.repo2"
gem "gem_depending_on_old_erb"
G
-
- bundle "exec erb --version", artifice: nil
end
it "uses resolved version" do
- expect(out).to eq(indirect_erb_version)
- expect(err).to be_empty
+ bundle "exec erb --version", artifice: nil
+
+ expect(stdboth).to eq(indirect_erb_version)
end
end
end