@@ -143,7 +143,7 @@ def test_something_else; end
143143 end
144144 RUBY
145145
146- with_server ( source ) do |server , uri |
146+ with_server ( source , URI :: Generic . from_path ( path : "/test/foo_test.rb" ) ) do |server , uri |
147147 server . global_state . index . index_single ( URI ( "/other_file.rb" ) , <<~RUBY )
148148 module Test
149149 module Unit
@@ -227,7 +227,7 @@ def test_something_else; end
227227 end
228228 RUBY
229229
230- with_server ( source ) do |server , uri |
230+ with_server ( source , URI :: Generic . from_path ( path : "/test/foo_test.rb" ) ) do |server , uri |
231231 server . global_state . index . index_single ( URI ( "/other_file.rb" ) , <<~RUBY )
232232 module Test
233233 module Unit
@@ -259,6 +259,39 @@ class TestCase; end
259259 end
260260 end
261261
262+ def test_does_not_collect_code_lenses_for_files_not_matching_path_convention
263+ source = <<~RUBY
264+ module Foo
265+ class MyTest < Test::Unit::TestCase
266+ def test_something; end
267+
268+ def test_something_else; end
269+ end
270+ end
271+ RUBY
272+
273+ with_server ( source , URI ::Generic . from_path ( path : "/tests/something.rb" ) ) do |server , uri |
274+ server . global_state . index . index_single ( URI ( "/other_file.rb" ) , <<~RUBY )
275+ module Test
276+ module Unit
277+ class TestCase; end
278+ end
279+ end
280+ RUBY
281+
282+ server . global_state . stubs ( :enabled_feature? ) . returns ( true )
283+
284+ server . process_message ( id : 1 , method : "textDocument/codeLens" , params : {
285+ textDocument : { uri : uri } ,
286+ } )
287+
288+ # Discard the indexing log message
289+ server . pop_response
290+ items = get_response ( server )
291+ assert_empty ( items )
292+ end
293+ end
294+
262295 def test_ignores_minitest_tests_that_extend_active_support_declarative
263296 source = <<~RUBY
264297 class MyTest < ActiveSupport::TestCase
0 commit comments