Skip to content

Commit

Permalink
Merge #2906 #2908
Browse files Browse the repository at this point in the history
2906: Backport ruby core r=hsbt a=hsbt

# Description:

Fixed the warnings with keyword separation feature of Ruby 2.7 and rondomly failed on GitHub Actions.
______________

# Tasks:

- [ ] Describe the problem / feature
- [ ] Write tests
- [ ] Write code to solve the problem
- [ ] Get code review from coworkers / friends

I will abide by the [code of conduct](https://github.com/rubygems/rubygems/blob/master/CODE_OF_CONDUCT.md).


2908: Fix underscore version selection for bundler r=hsbt a=deivid-rodriguez

# Description:

When rubygems' underscore version selection is used with bundler itself, it doesn't work. This PR should fix it.

# Tasks:

- [x] Describe the problem / feature
- [x] Write tests
- [x] Write code to solve the problem
- [ ] Get code review from coworkers / friends

I will abide by the [code of conduct](https://github.com/rubygems/rubygems/blob/master/CODE_OF_CONDUCT.md).

Fixes rubygems/bundler#7345.
Closes rubygems/bundler#7349.

Co-authored-by: Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
Co-authored-by: Jeremy Evans <code@jeremyevans.net>
Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
  • Loading branch information
4 people committed Sep 25, 2019
2 parents 359d1ab + 09e6f9a commit b96e707
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/rubygems/test_gem.rb
Expand Up @@ -375,6 +375,40 @@ def test_activate_bin_path_selects_exact_bundler_version_if_present
assert_equal %w(bundler-2.0.0), loaded_spec_names
end

def test_activate_bin_path_respects_underscore_selection_if_given
bundler_latest = util_spec 'bundler', '2.0.1' do |s|
s.executables = ['bundle']
end

bundler_previous = util_spec 'bundler', '1.17.3' do |s|
s.executables = ['bundle']
end

install_specs bundler_latest, bundler_previous

File.open("Gemfile.lock", "w") do |f|
f.write <<-L.gsub(/ {8}/, "")
GEM
remote: https://rubygems.org/
specs:
PLATFORMS
ruby
DEPENDENCIES
BUNDLED WITH
2.0.1
L
end

File.open("Gemfile", "w") { |f| f.puts('source "https://rubygems.org"') }

load Gem.activate_bin_path("bundler", "bundle", "= 1.17.3")

assert_equal %w(bundler-1.17.3), loaded_spec_names
end

def test_self_bin_path_no_exec_name
e = assert_raises ArgumentError do
Gem.bin_path 'a'
Expand Down

0 comments on commit b96e707

Please sign in to comment.