Skip to content

Commit 3b2d068

Browse files
deivid-rodriguezhsbt
authored andcommitted
[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. ruby/rubygems@451e07c305
1 parent d95f7a3 commit 3b2d068

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

spec/bundler/commands/exec_spec.rb

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,17 +193,20 @@
193193
end
194194

195195
context "with default gems" do
196-
let(:default_erb_version) { ruby "gem 'erb', '< 999999'; require 'erb/version'; puts Erb::VERSION", raise_on_error: false }
196+
# TODO: Switch to ERB::VERSION once Ruby 3.4 support is dropped, so all
197+
# supported rubies include an `erb` gem version where `ERB::VERSION` is
198+
# public
199+
let(:default_erb_version) { ruby "require 'erb/version'; puts ERB.const_get(:VERSION)" }
197200

198201
context "when not specified in Gemfile" do
199202
before do
200203
install_gemfile "source \"https://gem.repo1\""
201204
end
202205

203206
it "uses version provided by ruby" do
204-
bundle "exec erb --version"
207+
bundle "exec erb --version", artifice: nil
205208

206-
expect(out).to include(default_erb_version)
209+
expect(stdboth).to eq(default_erb_version)
207210
end
208211
end
209212

@@ -226,8 +229,7 @@
226229
it "uses version specified" do
227230
bundle "exec erb --version", artifice: nil
228231

229-
expect(out).to eq(specified_erb_version)
230-
expect(err).to be_empty
232+
expect(stdboth).to eq(specified_erb_version)
231233
end
232234
end
233235

@@ -249,13 +251,12 @@
249251
source "https://gem.repo2"
250252
gem "gem_depending_on_old_erb"
251253
G
252-
253-
bundle "exec erb --version", artifice: nil
254254
end
255255

256256
it "uses resolved version" do
257-
expect(out).to eq(indirect_erb_version)
258-
expect(err).to be_empty
257+
bundle "exec erb --version", artifice: nil
258+
259+
expect(stdboth).to eq(indirect_erb_version)
259260
end
260261
end
261262
end

0 commit comments

Comments
 (0)