Skip to content

Commit 4c1b1c1

Browse files
homusegiddins
authored andcommitted
Auto merge of #1877 - tpope:open-version, r=segiddins
Fix gem open to open highest version number rather than lowest I will abide by the [code of conduct](https://github.com/rubygems/rubygems/blob/master/CODE_OF_CONDUCT.md). (cherry picked from commit d775634)
1 parent 2dc81a5 commit 4c1b1c1

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/rubygems/commands/open_command.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def open_editor path
7272
end
7373

7474
def spec_for name
75-
spec = Gem::Specification.find_all_by_name(name, @version).last
75+
spec = Gem::Specification.find_all_by_name(name, @version).first
7676

7777
return spec if spec
7878

test/rubygems/test_gem_commands_open_command.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ def test_execute
2424
@cmd.options[:args] = %w[foo]
2525
@cmd.options[:editor] = "#{Gem.ruby} -e0 --"
2626

27-
spec = gem 'foo'
27+
gem 'foo', '1.0.0'
28+
spec = gem 'foo', '1.0.1'
2829
mock = MiniTest::Mock.new
2930
mock.expect(:call, true, [spec.full_gem_path])
3031

0 commit comments

Comments
 (0)