summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2025-01-10 15:04:35 +0100
committergit <svn-admin@ruby-lang.org>2025-01-10 16:01:49 +0000
commiteb8f29c46c3e9c9041dc0bfe133c06329f28a2e7 (patch)
tree5e101a47980c3e6a6c1c5e6e36628086ea000bd6
parent8adc96b5ca17c504d7a4afe7c6034c1d4d1984ba (diff)
[rubygems/rubygems] Fix test failure when running tests with ENV["EDITOR"] set
Can be reproduced, for example, with ``` bin/rspec spec/bundler/cli_spec.rb spec/other/cli_man_pages_spec.rb --order defined ``` https://github.com/rubygems/rubygems/commit/f57d199225
-rw-r--r--spec/bundler/spec_helper.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/spec/bundler/spec_helper.rb b/spec/bundler/spec_helper.rb
index 54b655389a..bf7604659c 100644
--- a/spec/bundler/spec_helper.rb
+++ b/spec/bundler/spec_helper.rb
@@ -9,7 +9,14 @@ if File.expand_path(__FILE__) =~ %r{([^\w/\.:\-])}
abort "The bundler specs cannot be run from a path that contains special characters (particularly #{$1.inspect})"
end
+# Bundler CLI will have different help text depending on whether this variable
+# is set, since the `-e` flag `bundle gem` with require an explicit value if
+# `EDITOR` is not set, but will use `EDITOR` by default is set. So make sure
+# it's `nil` before loading bundler to get a consistent help text, since some
+# tests rely on that.
+ENV["EDITOR"] = nil
require "bundler"
+
require "rspec/core"
require "rspec/expectations"
require "rspec/mocks"
@@ -82,7 +89,6 @@ RSpec.configure do |config|
ENV["RUBYGEMS_GEMDEPS"] = nil
ENV["XDG_CONFIG_HOME"] = nil
ENV["GEMRC"] = nil
- ENV["EDITOR"] = nil
# Don't wrap output in tests
ENV["THOR_COLUMNS"] = "10000"