Skip to content

Commit 88ee59c

Browse files
committed
Discover tests with an empty name
1 parent b2df3b6 commit 88ee59c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/ruby_lsp/ruby_lsp_rails/rails_test_style.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def on_call_node_enter(node)
4343
return unless first_arg.is_a?(Prism::StringNode)
4444

4545
test_name = first_arg.content
46-
return if test_name.empty?
46+
test_name = "<empty test name>" if test_name.empty?
4747

4848
add_test_item(node, test_name)
4949
end

test/ruby_lsp_rails/rails_test_style_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ class EmptyTest < ActiveSupport::TestCase
4949
assert_equal(1, items.length)
5050
test_class = items.first
5151
assert_equal("EmptyTest", test_class[:label])
52-
assert_equal(1, test_class[:children].length)
52+
assert_equal(2, test_class[:children].length)
5353

5454
test_labels = test_class[:children].map { |i| i[:label] }
55-
refute_includes(test_labels, "")
55+
assert_includes(test_labels, "<empty test name>")
5656
assert_all_items_tagged_with(items, :rails)
5757
end
5858
end

0 commit comments

Comments
 (0)