Skip to content

Commit

Permalink
[rubygems/rubygems] Fix test failure when running tests with ENV["EDI…
Browse files Browse the repository at this point in the history
…TOR"] set

Can be reproduced, for example, with

```
bin/rspec spec/bundler/cli_spec.rb spec/other/cli_man_pages_spec.rb --order defined
```

rubygems/rubygems@f57d199225
  • Loading branch information
deivid-rodriguez authored and matzbot committed Jan 10, 2025
1 parent 8adc96b commit eb8f29c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion spec/bundler/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
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"
Expand Down Expand Up @@ -82,7 +89,6 @@ def self.ruby=(ruby)
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"
Expand Down

0 comments on commit eb8f29c

Please sign in to comment.