We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9d04fcb commit a39dd2aCopy full SHA for a39dd2a
lib/ruby_lsp/ruby_lsp_rails/rails_test_style.rb
@@ -90,6 +90,10 @@ def on_call_node_enter(node)
90
91
test_name = first_arg.content
92
test_name = "<empty test name>" if test_name.empty?
93
+
94
+ # Rails' `test "foo bar"` helper defines a method `def test_foo_bar`. We normalize test names
95
+ # the same way (spaces to underscores, prefix with `test_`) to match the actual method names
96
+ # Rails uses at runtime, ensuring proper test discovery and execution.
97
rails_normalized_name = "test_#{test_name.gsub(/\s+/, "_")}"
98
99
add_test_item(node, rails_normalized_name)
0 commit comments