@@ -13,37 +13,21 @@ class CodeLens
1313 response_builder : ResponseBuilders ::CollectionResponseBuilder [ Interface ::CodeLens ] ,
1414 uri : URI ::Generic ,
1515 dispatcher : Prism ::Dispatcher ,
16- rspec_command : T . nilable ( String ) ,
16+ rspec_command : String ,
1717 debug : T ::Boolean ,
1818 ) . void
1919 end
20- def initialize ( response_builder , uri , dispatcher , rspec_command : nil , debug : false )
20+ def initialize ( response_builder , uri , dispatcher , rspec_command , debug : false )
2121 @response_builder = response_builder
2222 # Listener is only initialized if uri.to_standardized_path is valid
2323 @path = T . let ( T . must ( uri . to_standardized_path ) , String )
2424 @group_id = T . let ( 1 , Integer )
2525 @group_id_stack = T . let ( [ ] , T ::Array [ Integer ] )
26+ @rspec_command = rspec_command
2627 @anonymous_example_count = T . let ( 0 , Integer )
2728 dispatcher . register ( self , :on_call_node_enter , :on_call_node_leave )
2829
2930 @debug = debug
30- @base_command = T . let (
31- # The user-configured command takes precedence over inferred command default
32- rspec_command || begin
33- cmd = if File . exist? ( File . join ( Dir . pwd , "bin" , "rspec" ) )
34- "bin/rspec"
35- else
36- "rspec"
37- end
38-
39- if File . exist? ( "Gemfile.lock" )
40- "bundle exec #{ cmd } "
41- else
42- cmd
43- end
44- end ,
45- String ,
46- )
4731 end
4832
4933 sig { params ( node : Prism ::CallNode ) . void }
@@ -111,7 +95,7 @@ def generate_name(node)
11195 sig { params ( node : Prism ::Node , name : String , kind : Symbol ) . void }
11296 def add_test_code_lens ( node , name :, kind :)
11397 line_number = node . location . start_line
114- command = "#{ @base_command } #{ @path } :#{ line_number } "
98+ command = "#{ @rspec_command } #{ @path } :#{ line_number } "
11599
116100 log_message ( "Full command: `#{ command } `" ) if @debug
117101
0 commit comments