Skip to content

Commit f2c0576

Browse files
committed
Include ABI-scoped dirs in gem contents --spec-dir output
Assisted-By: devx/9c2464e2-74cd-4d36-a6c0-50aef8c2ad01
1 parent f665087 commit f2c0576

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

lib/rubygems/commands/contents_command.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def spec_for(name)
198198

199199
def specification_directories # :nodoc:
200200
options[:specdirs].flat_map do |i|
201-
[i, File.join(i, "specifications")]
201+
Gem::SpecificationRecord.dirs_with_abi([i, File.join(i, "specifications")])
202202
end
203203
end
204204
end

test/rubygems/test_gem_commands_contents_command.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,22 @@ def test_execute_bad_gem
6262
assert_equal "", @ui.error
6363
end
6464

65+
def test_execute_bad_gem_with_spec_dir
66+
@cmd.options[:args] = %w[foo]
67+
@cmd.options[:specdirs] = [@gemhome]
68+
69+
assert_raise Gem::MockGemUi::TermError do
70+
use_ui @ui do
71+
@cmd.execute
72+
end
73+
end
74+
75+
assert_match(/Unable to find gem 'foo' in specified path/, @ui.output)
76+
assert_match(/Directories searched:/, @ui.output)
77+
assert_match(File.join(@gemhome, "specifications", Gem.ruby_abi), @ui.output)
78+
assert_equal "", @ui.error
79+
end
80+
6581
def test_execute_exact_match
6682
@cmd.options[:args] = %w[foo]
6783
gem "foo"

0 commit comments

Comments
 (0)