solargraph-rspec 0.5.4 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,54 +1,51 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- solargraph-rspec (0.4.1)
5
- solargraph (~> 0.52, >= 0.52.0)
4
+ solargraph-rspec (0.5.5)
5
+ solargraph (>= 0.52.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actionmailer (7.1.5.1)
11
- actionpack (= 7.1.5.1)
12
- actionview (= 7.1.5.1)
13
- activejob (= 7.1.5.1)
14
- activesupport (= 7.1.5.1)
15
- mail (~> 2.5, >= 2.5.4)
16
- net-imap
17
- net-pop
18
- net-smtp
10
+ actionmailer (8.0.2.1)
11
+ actionpack (= 8.0.2.1)
12
+ actionview (= 8.0.2.1)
13
+ activejob (= 8.0.2.1)
14
+ activesupport (= 8.0.2.1)
15
+ mail (>= 2.8.0)
19
16
  rails-dom-testing (~> 2.2)
20
- actionpack (7.1.5.1)
21
- actionview (= 7.1.5.1)
22
- activesupport (= 7.1.5.1)
17
+ actionpack (8.0.2.1)
18
+ actionview (= 8.0.2.1)
19
+ activesupport (= 8.0.2.1)
23
20
  nokogiri (>= 1.8.5)
24
- racc
25
21
  rack (>= 2.2.4)
26
22
  rack-session (>= 1.0.1)
27
23
  rack-test (>= 0.6.3)
28
24
  rails-dom-testing (~> 2.2)
29
25
  rails-html-sanitizer (~> 1.6)
30
- actionview (7.1.5.1)
31
- activesupport (= 7.1.5.1)
26
+ useragent (~> 0.16)
27
+ actionview (8.0.2.1)
28
+ activesupport (= 8.0.2.1)
32
29
  builder (~> 3.1)
33
30
  erubi (~> 1.11)
34
31
  rails-dom-testing (~> 2.2)
35
32
  rails-html-sanitizer (~> 1.6)
36
- activejob (7.1.5.1)
37
- activesupport (= 7.1.5.1)
33
+ activejob (8.0.2.1)
34
+ activesupport (= 8.0.2.1)
38
35
  globalid (>= 0.3.6)
39
- activesupport (7.1.5.1)
36
+ activesupport (8.0.2.1)
40
37
  base64
41
38
  benchmark (>= 0.3)
42
39
  bigdecimal
43
- concurrent-ruby (~> 1.0, >= 1.0.2)
40
+ concurrent-ruby (~> 1.0, >= 1.3.1)
44
41
  connection_pool (>= 2.2.5)
45
42
  drb
46
43
  i18n (>= 1.6, < 2)
47
44
  logger (>= 1.4.2)
48
45
  minitest (>= 5.1)
49
- mutex_m
50
46
  securerandom (>= 0.3)
51
- tzinfo (~> 2.0)
47
+ tzinfo (~> 2.0, >= 2.0.5)
48
+ uri (>= 0.13.1)
52
49
  addressable (2.8.7)
53
50
  public_suffix (>= 2.0.2, < 7.0)
54
51
  airborne (0.3.7)
@@ -63,50 +60,54 @@ GEM
63
60
  thor (>= 0.14.0)
64
61
  ast (2.4.3)
65
62
  backport (1.2.0)
66
- base64 (0.2.0)
67
- benchmark (0.4.0)
68
- bigdecimal (3.1.9)
63
+ base64 (0.3.0)
64
+ benchmark (0.5.0)
65
+ bigdecimal (3.2.3)
69
66
  builder (3.3.0)
70
- byebug (11.1.3)
67
+ byebug (12.0.0)
71
68
  coderay (1.1.3)
69
+ commander (5.0.0)
70
+ highline (~> 3.0.0)
72
71
  concurrent-ruby (1.3.5)
73
- connection_pool (2.5.0)
72
+ connection_pool (2.5.4)
74
73
  crack (1.0.0)
75
74
  bigdecimal
76
75
  rexml
77
76
  crass (1.0.6)
78
77
  date (3.4.1)
79
- debug (1.10.0)
78
+ debug (1.11.0)
80
79
  irb (~> 1.10)
81
80
  reline (>= 0.3.8)
82
- diff-lcs (1.6.0)
81
+ diff-lcs (1.6.2)
83
82
  docile (1.4.1)
84
83
  domain_name (0.6.20240107)
85
- drb (2.2.1)
84
+ drb (2.2.3)
85
+ erb (5.0.2)
86
86
  erubi (1.13.1)
87
87
  globalid (1.2.1)
88
88
  activesupport (>= 6.1)
89
- hashdiff (1.1.2)
89
+ hashdiff (1.2.1)
90
+ highline (3.0.1)
90
91
  http-accept (1.7.0)
91
92
  http-cookie (1.0.8)
92
93
  domain_name (~> 0.5)
93
94
  i18n (1.14.7)
94
95
  concurrent-ruby (~> 1.0)
95
- io-console (0.8.0)
96
- irb (1.15.1)
96
+ io-console (0.8.1)
97
+ irb (1.15.2)
97
98
  pp (>= 0.6.0)
98
99
  rdoc (>= 4.0.0)
99
100
  reline (>= 0.4.2)
100
- jaro_winkler (1.6.0)
101
- json (2.10.2)
102
- kramdown (2.5.1)
103
- rexml (>= 3.3.9)
101
+ jaro_winkler (1.7.0)
102
+ json (2.21.2)
103
+ kramdown (2.5.2)
104
+ rexml (>= 3.4.4)
104
105
  kramdown-parser-gfm (1.1.0)
105
106
  kramdown (~> 2.0)
106
- language_server-protocol (3.17.0.4)
107
+ language_server-protocol (3.17.0.6)
107
108
  lint_roller (1.1.0)
108
- logger (1.6.6)
109
- loofah (2.24.0)
109
+ logger (1.7.0)
110
+ loofah (2.24.1)
110
111
  crass (~> 1.0.2)
111
112
  nokogiri (>= 1.12.0)
112
113
  mail (2.8.1)
@@ -115,14 +116,13 @@ GEM
115
116
  net-pop
116
117
  net-smtp
117
118
  method_source (1.1.0)
118
- mime-types (3.6.1)
119
+ mime-types (3.7.0)
119
120
  logger
120
- mime-types-data (~> 3.2015)
121
- mime-types-data (3.2025.0318)
121
+ mime-types-data (~> 3.2025, >= 3.2025.0507)
122
+ mime-types-data (3.2025.0916)
122
123
  mini_mime (1.1.5)
123
124
  minitest (5.25.5)
124
- mutex_m (0.3.0)
125
- net-imap (0.4.19)
125
+ net-imap (0.4.22)
126
126
  date
127
127
  net-protocol
128
128
  net-pop (0.1.2)
@@ -132,33 +132,40 @@ GEM
132
132
  net-smtp (0.5.1)
133
133
  net-protocol
134
134
  netrc (0.11.0)
135
- nokogiri (1.17.2-arm64-darwin)
135
+ nokogiri (1.19.4-arm64-darwin)
136
136
  racc (~> 1.4)
137
137
  observer (0.1.2)
138
+ open3 (0.2.1)
138
139
  optparse (0.6.0)
139
- ostruct (0.6.1)
140
- parallel (1.26.3)
141
- parser (3.3.7.2)
140
+ ostruct (0.6.3)
141
+ parallel (2.1.0)
142
+ parlour (9.1.2)
143
+ commander (~> 5.0)
144
+ parser
145
+ rainbow (~> 3.0)
146
+ sorbet-runtime (>= 0.5)
147
+ parser (3.3.12.0)
142
148
  ast (~> 2.4.1)
143
149
  racc
144
150
  pp (0.6.2)
145
151
  prettyprint
146
152
  prettyprint (0.2.0)
147
- profile-viewer (0.0.4)
153
+ prism (1.9.0)
154
+ profile-viewer (0.0.5)
148
155
  optparse
149
156
  webrick
150
- pry (0.14.2)
157
+ pry (0.15.2)
151
158
  coderay (~> 1.1)
152
159
  method_source (~> 1.0)
153
- pry-byebug (3.10.1)
154
- byebug (~> 11.0)
155
- pry (>= 0.13, < 0.15)
156
- psych (5.2.3)
160
+ pry-byebug (3.11.0)
161
+ byebug (~> 12.0)
162
+ pry (>= 0.13, < 0.16)
163
+ psych (5.2.6)
157
164
  date
158
165
  stringio
159
- public_suffix (6.0.1)
166
+ public_suffix (6.0.2)
160
167
  racc (1.8.1)
161
- rack (2.2.13)
168
+ rack (2.2.17)
162
169
  rack-session (1.0.2)
163
170
  rack (< 3)
164
171
  rack-test (1.1.0)
@@ -166,82 +173,91 @@ GEM
166
173
  rackup (1.0.1)
167
174
  rack (< 3)
168
175
  webrick
169
- rails-dom-testing (2.2.0)
176
+ rails-dom-testing (2.3.0)
170
177
  activesupport (>= 5.0.0)
171
178
  minitest
172
179
  nokogiri (>= 1.6)
173
180
  rails-html-sanitizer (1.6.2)
174
181
  loofah (~> 2.21)
175
182
  nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
176
- railties (7.1.5.1)
177
- actionpack (= 7.1.5.1)
178
- activesupport (= 7.1.5.1)
179
- irb
183
+ railties (8.0.2.1)
184
+ actionpack (= 8.0.2.1)
185
+ activesupport (= 8.0.2.1)
186
+ irb (~> 1.13)
180
187
  rackup (>= 1.0.0)
181
188
  rake (>= 12.2)
182
189
  thor (~> 1.0, >= 1.2.2)
183
190
  zeitwerk (~> 2.6)
184
191
  rainbow (3.1.1)
185
- rake (13.2.1)
186
- rbs (3.6.1)
192
+ rake (13.3.0)
193
+ rbs (4.1.3)
187
194
  logger
188
- rdoc (6.12.0)
195
+ prism (>= 1.6.0)
196
+ tsort
197
+ rdoc (7.2.0)
198
+ erb
189
199
  psych (>= 4.0.0)
190
- redis-client (0.24.0)
200
+ tsort
201
+ redis-client (0.25.3)
191
202
  connection_pool
192
- regexp_parser (2.10.0)
193
- reline (0.6.0)
203
+ regexp_parser (2.12.0)
204
+ reline (0.6.2)
194
205
  io-console (~> 0.5)
195
206
  rest-client (2.1.0)
196
207
  http-accept (>= 1.7.0, < 2.0)
197
208
  http-cookie (>= 1.0.2, < 2.0)
198
209
  mime-types (>= 1.16, < 4.0)
199
210
  netrc (~> 0.8)
200
- reverse_markdown (3.0.0)
211
+ reverse_markdown (3.0.2)
201
212
  nokogiri
202
- rexml (3.4.1)
203
- rspec (3.13.0)
213
+ rexml (3.4.4)
214
+ rspec (3.13.1)
204
215
  rspec-core (~> 3.13.0)
205
216
  rspec-expectations (~> 3.13.0)
206
217
  rspec-mocks (~> 3.13.0)
207
- rspec-core (3.13.3)
218
+ rspec-core (3.13.5)
208
219
  rspec-support (~> 3.13.0)
209
- rspec-expectations (3.13.3)
220
+ rspec-expectations (3.13.5)
210
221
  diff-lcs (>= 1.2.0, < 2.0)
211
222
  rspec-support (~> 3.13.0)
212
- rspec-mocks (3.13.2)
223
+ rspec-mocks (3.13.5)
213
224
  diff-lcs (>= 1.2.0, < 2.0)
214
225
  rspec-support (~> 3.13.0)
215
- rspec-rails (7.1.1)
216
- actionpack (>= 7.0)
217
- activesupport (>= 7.0)
218
- railties (>= 7.0)
226
+ rspec-rails (8.0.2)
227
+ actionpack (>= 7.2)
228
+ activesupport (>= 7.2)
229
+ railties (>= 7.2)
219
230
  rspec-core (~> 3.13)
220
231
  rspec-expectations (~> 3.13)
221
232
  rspec-mocks (~> 3.13)
222
233
  rspec-support (~> 3.13)
223
- rspec-sidekiq (5.1.0)
234
+ rspec-sidekiq (5.2.0)
224
235
  rspec-core (~> 3.0)
225
236
  rspec-expectations (~> 3.0)
226
237
  rspec-mocks (~> 3.0)
227
238
  sidekiq (>= 5, < 9)
228
- rspec-support (3.13.2)
229
- rubocop (1.74.0)
239
+ rspec-support (3.13.6)
240
+ rubocop (1.89.0)
230
241
  json (~> 2.3)
231
242
  language_server-protocol (~> 3.17.0.2)
232
243
  lint_roller (~> 1.1.0)
233
- parallel (~> 1.10)
244
+ parallel (>= 1.10)
234
245
  parser (>= 3.3.0.2)
235
246
  rainbow (>= 2.2.2, < 4.0)
236
247
  regexp_parser (>= 2.9.3, < 3.0)
237
- rubocop-ast (>= 1.38.0, < 2.0)
248
+ rubocop-ast (>= 1.49.0, < 2.0)
238
249
  ruby-progressbar (~> 1.7)
239
250
  unicode-display_width (>= 2.4.0, < 4.0)
240
- rubocop-ast (1.41.0)
251
+ rubocop-ast (1.50.0)
241
252
  parser (>= 3.3.7.2)
253
+ prism (~> 1.7)
254
+ rubocop-yard (1.0.0)
255
+ lint_roller
256
+ rubocop (~> 1.72)
257
+ yard
242
258
  ruby-progressbar (1.13.0)
243
- securerandom (0.3.2)
244
- shoulda-matchers (6.4.0)
259
+ securerandom (0.4.1)
260
+ shoulda-matchers (6.5.0)
245
261
  activesupport (>= 5.2.0)
246
262
  sidekiq (7.3.9)
247
263
  base64
@@ -253,70 +269,99 @@ GEM
253
269
  docile (~> 1.1)
254
270
  simplecov-html (~> 0.11)
255
271
  simplecov_json_formatter (~> 0.1)
256
- simplecov-cobertura (2.1.0)
272
+ simplecov-cobertura (3.1.0)
257
273
  rexml
258
274
  simplecov (~> 0.19)
259
- simplecov-html (0.13.1)
275
+ simplecov-html (0.13.2)
260
276
  simplecov_json_formatter (0.1.4)
261
- solargraph (0.52.0)
277
+ solargraph (0.60.3)
278
+ ast (~> 2.4.3)
262
279
  backport (~> 1.2)
263
- benchmark
264
- bundler (~> 2.0)
280
+ benchmark (~> 0.4)
281
+ bundler (>= 2.0)
265
282
  diff-lcs (~> 1.4)
266
- jaro_winkler (~> 1.6)
283
+ jaro_winkler (~> 1.6, >= 1.6.1)
267
284
  kramdown (~> 2.3)
268
285
  kramdown-parser-gfm (~> 1.1)
269
286
  logger (~> 1.6)
270
287
  observer (~> 0.1)
288
+ open3 (~> 0.2.1)
271
289
  ostruct (~> 0.6)
272
290
  parser (~> 3.0)
273
- rbs (~> 3.0)
274
- reverse_markdown (>= 2.0, < 4)
275
- rubocop (~> 1.38)
291
+ prism (~> 1.4)
292
+ rbs (>= 3.10.0)
293
+ rdoc (~> 7.0)
294
+ reverse_markdown (~> 3.0)
295
+ rubocop (~> 1.76)
296
+ sord (~> 7.0)
276
297
  thor (~> 1.0)
277
298
  tilt (~> 2.0)
278
299
  yard (~> 0.9, >= 0.9.24)
300
+ yard-activesupport-concern (~> 0.0)
279
301
  yard-solargraph (~> 0.1)
280
- stringio (3.1.5)
281
- thor (1.3.2)
282
- tilt (2.6.0)
302
+ sorbet-runtime (0.6.13425)
303
+ sord (7.1.0)
304
+ commander (~> 5.0)
305
+ parlour (~> 9.1)
306
+ parser
307
+ rbs (>= 3.0, < 5)
308
+ sorbet-runtime
309
+ yard
310
+ stringio (3.1.7)
311
+ thor (1.5.0)
312
+ tilt (2.8.0)
283
313
  timeout (0.4.3)
314
+ tsort (0.2.0)
284
315
  tzinfo (2.0.6)
285
316
  concurrent-ruby (~> 1.0)
286
- unicode-display_width (3.1.4)
287
- unicode-emoji (~> 4.0, >= 4.0.4)
288
- unicode-emoji (4.0.4)
317
+ unicode-display_width (3.2.0)
318
+ unicode-emoji (~> 4.1)
319
+ unicode-emoji (4.2.0)
320
+ unparser (0.8.0)
321
+ diff-lcs (~> 1.6)
322
+ parser (>= 3.3.0)
323
+ prism (>= 1.4)
324
+ uri (1.0.3)
325
+ useragent (0.16.11)
289
326
  webmock (3.25.1)
290
327
  addressable (>= 2.8.0)
291
328
  crack (>= 0.3.2)
292
329
  hashdiff (>= 0.4.0, < 2.0.0)
293
330
  webrick (1.9.1)
294
- yard (0.9.37)
331
+ yard (0.9.45)
332
+ yard-activesupport-concern (0.0.1)
333
+ yard (>= 0.8)
295
334
  yard-solargraph (0.1.0)
296
335
  yard (~> 0.9)
297
- zeitwerk (2.6.18)
336
+ zeitwerk (2.7.3)
298
337
 
299
338
  PLATFORMS
339
+ arm64-darwin-22
340
+ arm64-darwin-23
300
341
  arm64-darwin-24
301
342
 
302
343
  DEPENDENCIES
303
- actionmailer
344
+ actionmailer (>= 7)
304
345
  airborne
305
346
  appraisal
306
347
  bundler
307
348
  debug
349
+ net-imap (~> 0.4.0)
308
350
  profile-viewer
309
351
  pry-byebug
310
352
  rake
353
+ rbs
311
354
  rspec
312
- rspec-rails
355
+ rspec-rails (>= 7)
313
356
  rspec-sidekiq
314
357
  rubocop
358
+ rubocop-yard
315
359
  shoulda-matchers
316
360
  simplecov
317
361
  simplecov-cobertura
318
362
  solargraph-rspec!
363
+ unparser
319
364
  webmock
320
365
 
321
366
  BUNDLED WITH
322
- 2.3.17
367
+ 2.6.9
@@ -6,6 +6,9 @@ module Solargraph
6
6
  # rspec:
7
7
  # let_methods:
8
8
  # - let_it_be
9
+ # config_helper_files:
10
+ # - spec/spec_helper.rb
11
+ # - spec/rails_helper.rb
9
12
  class Config
10
13
  def initialize(solargraph_config = Solargraph::Workspace::Config.new('./'))
11
14
  @solargraph_config = solargraph_config
@@ -25,8 +28,18 @@ module Solargraph
25
28
  (Rspec::EXAMPLE_METHODS + additional_example_methods).map(&:to_sym)
26
29
  end
27
30
 
31
+ # @return [Array<String>]
32
+ def config_helper_files
33
+ DEFAULT_CONFIG_HELPER_FILES + additional_config_helper_files
34
+ end
35
+
28
36
  private
29
37
 
38
+ DEFAULT_CONFIG_HELPER_FILES = [
39
+ 'spec/spec_helper.rb',
40
+ 'spec/rails_helper.rb'
41
+ ].freeze
42
+
30
43
  # @return [Hash]
31
44
  def rspec_raw_data
32
45
  @rspec_raw_data ||= raw_data['rspec'] || {}
@@ -34,12 +47,23 @@ module Solargraph
34
47
 
35
48
  # @return [Array<Symbol>]
36
49
  def additional_let_methods
37
- (rspec_raw_data['let_methods'] || []).map(&:to_sym)
50
+ # @type [Array<String>, nil]
51
+ let_methods = rspec_raw_data['let_methods']
52
+ (let_methods || []).map(&:to_sym)
38
53
  end
39
54
 
40
55
  # @return [Array<Symbol>]
41
56
  def additional_example_methods
42
- (rspec_raw_data['example_methods'] || []).map(&:to_sym)
57
+ # @type [Array<String>, nil]
58
+ example_methods = rspec_raw_data['example_methods']
59
+ (example_methods || []).map(&:to_sym)
60
+ end
61
+
62
+ # @return [Array<String>]
63
+ def additional_config_helper_files
64
+ # @type [Array<String>, nil]
65
+ config_files = rspec_raw_data['config_helper_files']
66
+ config_files || []
43
67
  end
44
68
 
45
69
  # @return [Hash]
@@ -9,8 +9,9 @@ require_relative 'correctors/described_class_corrector'
9
9
  require_relative 'correctors/let_methods_corrector'
10
10
  require_relative 'correctors/subject_method_corrector'
11
11
  require_relative 'correctors/dsl_methods_corrector'
12
- require_relative 'test_helpers'
12
+ require_relative 'gems'
13
13
  require_relative 'pin_factory'
14
+ require_relative 'rspec_configure'
14
15
 
15
16
  module Solargraph
16
17
  module Rspec
@@ -78,16 +79,24 @@ module Solargraph
78
79
  filename.include?('spec/')
79
80
  end
80
81
 
81
- # @param yard_map [YardMap]
82
+ # @param _yard_map [YardMap]
82
83
  # @return [Environ]
83
84
  def global(_yard_map)
84
85
  pins = []
85
- pins += Solargraph::Rspec::TestHelpers.include_helper_pins(
86
+ pins += Solargraph::Rspec::Gems.include_helper_pins(
86
87
  root_example_group_namespace_pin: root_example_group_namespace_pin
87
88
  )
88
89
  pins += annotation_pins
90
+
91
+ # Add pins from RSpec.configure blocks
92
+ rspec_configure = RSpecConfigure.new(
93
+ config: config,
94
+ root_namespace_pin: root_example_group_namespace_pin
95
+ )
96
+ pins += rspec_configure.pins
97
+
89
98
  # TODO: Include gem requires conditionally based on Gemfile definition
90
- requires = Solargraph::Rspec::TestHelpers.gem_names
99
+ requires = Solargraph::Rspec::Gems.gem_names + rspec_configure.extra_requires
91
100
 
92
101
  if pins.any?
93
102
  Solargraph.logger.debug(
@@ -12,7 +12,7 @@ module Solargraph
12
12
  # @return [Solargraph::Rspec::SpecWalker]
13
13
  attr_reader :rspec_walker
14
14
 
15
- # @return [Array<Solargraph::Pin::Base]
15
+ # @return [Array<Solargraph::Pin::Base>]
16
16
  attr_reader :added_pins
17
17
 
18
18
  # @param namespace_pins [Array<Solargraph::Pin::Base>]
@@ -68,11 +68,61 @@ module Solargraph
68
68
  # @param pin [Solargraph::Pin::Base]
69
69
  # @param new_closure [Solargraph::Pin::Closure]
70
70
  def override_closure(pin, new_closure)
71
+ if pin.respond_to?(:closure=)
72
+ pin.closure = new_closure
73
+ return
74
+ end
75
+
76
+ # work around older version of Solargraph
71
77
  pin.instance_variable_set('@closure', new_closure)
72
78
  pin.reset_generated!
73
79
 
74
80
  pin.remove_instance_variable(:@path) if pin.instance_variables.include? :@path
75
81
  end
82
+
83
+ # Given the following code, Solargraph::Parser.node_range returns the following range for block ast:
84
+ #
85
+ # ```ruby
86
+ # some_method_with_block do
87
+ # ^ - block start
88
+ # end
89
+ # ^ - block end
90
+ # ```
91
+ #
92
+ # Instead we want the range to be:
93
+ #
94
+ # ```ruby
95
+ # some_method_with_block do
96
+ # ^ - block start
97
+ # end
98
+ # ^ - block end
99
+ # ```
100
+ #
101
+ # @param closure [Solargraph::Pin::Closure]
102
+ # @param source_map [Solargraph::SourceMap]
103
+ # @return [void]
104
+ def override_block_location(closure, source_map)
105
+ range = closure.location.range
106
+ block_ast = source_map.source.node_at(range.ending.line, range.ending.column)
107
+ new_location = PinFactory.build_location(
108
+ PinFactory.build_location_range(block_ast),
109
+ closure.location.filename
110
+ )
111
+
112
+ if closure.respond_to?(:location=)
113
+ closure.location = new_location
114
+ else
115
+ # work around older version of Solargraph
116
+ closure.instance_variable_set('@location', new_location)
117
+ closure.reset_generated!
118
+ end
119
+
120
+ # find children of this pin and reset them, as they may have
121
+ # cached their binder or context based on the old closure
122
+ source_map.pins.select { |child_pin| child_pin.closure == closure }.each do |child_pin|
123
+ child_pin.reset_generated!
124
+ end
125
+ end
76
126
  end
77
127
  end
78
128
  end
@@ -26,6 +26,7 @@ module Solargraph
26
26
  )
27
27
 
28
28
  override_closure(original_block_pin, namespace_pin)
29
+ override_block_location(original_block_pin, source_map)
29
30
 
30
31
  # Include DSL methods in the example group block
31
32
  # TODO: This does not work on solagraph! Class methods are not included from parent class.
@@ -7,7 +7,7 @@ module Solargraph
7
7
  module Correctors
8
8
  # Defines `described_class` method in the example group block
9
9
  class DescribedClassCorrector < Base
10
- # @param source_map [Solargraph::SourceMap]
10
+ # @param _source_map [Solargraph::SourceMap]
11
11
  # @return [void]
12
12
  def correct(_source_map)
13
13
  rspec_walker.on_described_class do |described_class_name, location_range|
@@ -45,6 +45,7 @@ module Solargraph
45
45
  location_range.start.column)
46
46
 
47
47
  override_closure(original_block_pin, example_run_method(namespace_pin))
48
+ override_block_location(original_block_pin, source_map)
48
49
  end
49
50
 
50
51
  # @param namespace_pin [Solargraph::Pin::Namespace]
@@ -7,7 +7,7 @@ module Solargraph
7
7
  module Correctors
8
8
  # Defines let-like methods in the example group block
9
9
  class LetMethodsCorrector < Base
10
- # @param source_map [Solargraph::SourceMap]
10
+ # @param _source_map [Solargraph::SourceMap]
11
11
  # @return [void]
12
12
  def correct(_source_map)
13
13
  rspec_walker.on_let_method do |let_name, location_range, fake_method_ast|
@@ -23,6 +23,7 @@ module Solargraph
23
23
 
24
24
  # @param namespace [Pin::Namespace]
25
25
  # @param method_name [String]
26
+ # @param location_range [Range]
26
27
  # @param node [::Parser::AST::Node, nil]
27
28
  # @param types [Array<String>, nil]
28
29
  # @return [Pin::Method, nil]
@@ -7,7 +7,7 @@ module Solargraph
7
7
  module Correctors
8
8
  # Defines let-like methods in the example group block
9
9
  class SubjectMethodCorrector < LetMethodsCorrector
10
- # @param source_map [Solargraph::SourceMap]
10
+ # @param _source_map [Solargraph::SourceMap]
11
11
  # @return [void]
12
12
  def correct(_source_map)
13
13
  rspec_walker.on_subject do |subject_name, location_range, fake_method_ast|
@@ -75,7 +75,7 @@ module Solargraph
75
75
  end
76
76
 
77
77
  # @param namespace_pin [Pin::Namespace]
78
- # @param method_name [:is_expected, :should, :should_not]
78
+ # @param method_name [:is_expected, :should, :should_not] # rubocop:disable YARD/TagTypeSyntax
79
79
  # @param location [Solargraph::Location]
80
80
  # @return [Pin::Method]
81
81
  def one_liner_expectation_pin(namespace_pin, method_name, location)