solargraph-rspec 0.5.4 → 0.5.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8be3e0236b9ee7ad2bc78abe9764001fc4ec2432a381571e23dddc27923caacb
4
- data.tar.gz: 217d891f9561406a322f037948f13a3197f39d980f8394e36fc86304b8bccde9
3
+ metadata.gz: e419b2a50e53e4fab9030c7efc9821aef1c245987b50c87e0222e7889a024065
4
+ data.tar.gz: 0eb5170d658591b473c7c9df2613d017889bcf0c4e9488579ae07b6fa40c1e2c
5
5
  SHA512:
6
- metadata.gz: 1c91744f1a8a2bb3a021f6cf008d627a292bf112c15b8215d7c9217d7bddf812b1f73b92a8d434d54755b10dd77b1f6b571c0b77ada0087b28e01e9f311e9c58
7
- data.tar.gz: 3d9a7e4405f2ce232d31e7310a2af32c1f0e1d86cc8b48b461c899310b6bf9a8c9f43a1a0c661074fd670d1433827472161618a3ddb0cbfda551b8ab06953bac
6
+ metadata.gz: 4fd09eda66acdf1c5688152d5b5fae30afc7c97461eefd13bbf2c5e9be8fae53a05c822e7d3cb2a03d46d7823016c6119d0887fb0d6f1ee165010f824450617b
7
+ data.tar.gz: 54d762f7d838d9671ef57a3e9963fdba3ec850ce51ae8d69b9d05fb27dc569370feda39c7d09f1056dce6f6a384d097d30aa361de4adf5ed5b2d480d591b3867
data/.rspec CHANGED
@@ -1,3 +1,4 @@
1
1
  --format documentation
2
2
  --color
3
3
  --require spec_helper
4
+ --profile
data/.rubocop.yml CHANGED
@@ -1,17 +1,19 @@
1
+ plugins:
2
+ - rubocop-yard
3
+
1
4
  AllCops:
2
5
  TargetRubyVersion: 3.0
3
6
  NewCops: enable
7
+ Exclude:
8
+ - 'gemfiles/**/*' # these are autogenerated files
9
+ - 'tmp/**/*' # git ignored anyway
4
10
 
5
11
  Style/StringLiterals:
6
12
  Enabled: true
7
13
  EnforcedStyle: single_quotes
8
- Exclude:
9
- - "gemfiles/**/*"
10
14
 
11
15
  Style/FrozenStringLiteralComment:
12
16
  Enabled: true
13
- Exclude:
14
- - "gemfiles/**/*"
15
17
 
16
18
  Style/StringLiteralsInInterpolation:
17
19
  Enabled: true
@@ -0,0 +1,26 @@
1
+ ---
2
+ include:
3
+ - "**/*.rb"
4
+ exclude:
5
+ - "spec/solargraph/**/*"
6
+ - test/**/*
7
+ - vendor/**/*
8
+ - ".bundle/**/*"
9
+ require: []
10
+ domains: []
11
+ reporters:
12
+ - typecheck:strict
13
+ - rubocop
14
+ - require_not_found
15
+ formatter:
16
+ rubocop:
17
+ cops: all
18
+ require_paths: []
19
+ plugins:
20
+ - solargraph-rspec
21
+ max_files: 20000
22
+ rspec:
23
+ let_methods:
24
+ - let_it_be
25
+ example_methods:
26
+ - my_example
data/Appraisals CHANGED
@@ -2,4 +2,11 @@
2
2
 
3
3
  appraise 'default' do
4
4
  # default gems from Gemfile
5
+ gem 'net-imap', '~> 0.4.0' # https://github.com/lsegal/yard/issues/1629
6
+ gem 'actionmailer'
7
+ gem 'airborne'
8
+ gem 'rspec-rails'
9
+ gem 'rspec-sidekiq'
10
+ gem 'shoulda-matchers'
11
+ gem 'webmock'
5
12
  end
data/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Fixed
11
+ - Go-to-defintion/Hover for RSpec DSL methods (eg. context or it)
12
+
13
+ ### Changed
14
+ - Update testing steps in developer documentation
15
+
10
16
  ## [0.5.3] - 2025-09-02
11
17
 
12
18
  ### Fixed
@@ -125,7 +131,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
125
131
  ### Added
126
132
 
127
133
  - `describe` and `it` methods completion
128
- - memoized `let` and `let!` methods completion
134
+ - memoized `let` and `let!` methods completion
129
135
  - implicit and explicit `subject` methods
130
136
  - `described_class` with appropriate type inference
131
137
  - `RSpec::Matchers` methods completion
data/README.md CHANGED
@@ -5,11 +5,11 @@
5
5
  [![codecov](https://codecov.io/gh/lekemula/solargraph-rspec/graph/badge.svg?token=FH7ER8ZDPW)](https://codecov.io/gh/lekemula/solargraph-rspec)
6
6
 
7
7
 
8
- RSpec is a testing framework of choice for many Ruby developers. But at the same time is highly dynamic and heavily relying on metaprogramming making it hard to provide accurate code completion and type inference.
8
+ RSpec is a testing framework of choice for many Ruby developers. But at the same time is highly dynamic and heavily relying on metaprogramming making it hard to provide accurate code completion and type inference.
9
9
 
10
10
  This gem aims to provide better support for RSpec in Solargraph and it supports the following features (completion, jump to definition and type inference 🚀):
11
- - `describe` and `it` methods
12
- - memoized `let` and `let!` methods
11
+ - `describe` and `it` methods
12
+ - memoized `let` and `let!` methods
13
13
  - `described_class` with appropriate type inference
14
14
  - implicit and explicit `subject` methods
15
15
  - one liner syntax helpers `is_expected`, `should` and `should_not` linked to the appropriate subject
@@ -110,7 +110,7 @@ Run `yard config --gem-install-yri` to generate YARD documentation automatically
110
110
 
111
111
  ## Acknowledgements
112
112
 
113
- This gem is inspired by the [solargraph-rails](https://github.com/iftheshoefritz/solargraph-rails) which gave me an idea of how to extend Solargraph with custom features and provided me with simple and very understandable test suite which helped me to get started with playing around with Solargraph.
113
+ This gem is inspired by the [solargraph-rails](https://github.com/iftheshoefritz/solargraph-rails) which gave me an idea of how to extend Solargraph with custom features and provided me with simple and very understandable test suite which helped me to get started with playing around with Solargraph.
114
114
 
115
115
  In fact, most of the code I initially wrote on [a fork](https://github.com/lekemula/solargraph-rails/tree/rspec-support) of it, but then I realized that it would make more sense to extract it into a separate gem where it could be used by non-Rails projects as well.
116
116
 
@@ -128,17 +128,23 @@ It's codebase IMO is an exemplary of how Ruby code written in a very simple PORO
128
128
 
129
129
  Code contributions are always appreciated. Feel free to fork the repo and submit pull requests. Check for open issues that could use help. Start new issues to discuss changes that have a major impact on the code or require large time commitments.
130
130
 
131
- Contributing is easy:
131
+ Contributing is easy - note that this Gem uses 'appraisal' to test against RSpec 3rd party plugins without adding to the main `Gemfile`:
132
132
  1. Create a fork and clone it
133
- 2. Run `bundle install` to install dependencies
134
- 3. Run `yard gems` to generate YARD documentation for your installed gems
135
- 4. Run `bundle exec spec` to run the tests
136
- 5. Introduce your awesome changes
137
- 6. Ensure they are well covered with tests
138
- 7. Record your changes in the [CHANGELOG.md](./CHANGELOG.md)
139
- 7. Submit a pull request :rocket:
133
+ 2. Verify tests are green:
134
+ ```sh
135
+ bundle install
136
+ bundle exec appraisal install
137
+ cp .solargraph.yml.example .solargraph.yml
138
+ bundle exec appraisal bundle exec rbs collection update
139
+ rspec_gems=$(bundle exec appraisal bundle exec ruby -r './lib/solargraph-rspec' -e 'puts Solargraph::Rspec::Gems.gem_names.join(" ")' 2>/dev/null | tail -n1)
140
+ bundle exec appraisal bundle exec solargraph gems $rspec_gems
141
+ bundle exec appraisal rspec
142
+ ```
143
+ 3. Introduce your awesome changes
144
+ 4. Ensure they are well covered with tests
145
+ 5. Record your changes in the [CHANGELOG.md](./CHANGELOG.md)
146
+ 6. Submit a pull request :rocket:
140
147
 
141
148
  ## License
142
149
 
143
150
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
144
-
@@ -8,18 +8,19 @@ gem "debug"
8
8
  gem "profile-viewer"
9
9
  gem "pry-byebug"
10
10
  gem "rake"
11
+ gem "rbs"
11
12
  gem "rspec"
12
13
  gem "rubocop"
14
+ gem "rubocop-yard"
13
15
  gem "simplecov"
14
16
  gem "simplecov-cobertura"
15
-
16
- group :third_party_plugin_tests do
17
- gem "actionmailer"
18
- gem "airborne"
19
- gem "rspec-rails"
20
- gem "rspec-sidekiq"
21
- gem "shoulda-matchers"
22
- gem "webmock"
23
- end
17
+ gem "unparser"
18
+ gem "net-imap", "~> 0.4.0"
19
+ gem "actionmailer"
20
+ gem "airborne"
21
+ gem "rspec-rails"
22
+ gem "rspec-sidekiq"
23
+ gem "shoulda-matchers"
24
+ gem "webmock"
24
25
 
25
26
  gemspec path: "../"
@@ -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.4)
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,51 @@ 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.4.1)
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)
72
69
  concurrent-ruby (1.3.5)
73
- connection_pool (2.5.0)
70
+ connection_pool (2.5.4)
74
71
  crack (1.0.0)
75
72
  bigdecimal
76
73
  rexml
77
74
  crass (1.0.6)
78
75
  date (3.4.1)
79
- debug (1.10.0)
76
+ debug (1.11.0)
80
77
  irb (~> 1.10)
81
78
  reline (>= 0.3.8)
82
- diff-lcs (1.6.0)
79
+ diff-lcs (1.6.2)
83
80
  docile (1.4.1)
84
81
  domain_name (0.6.20240107)
85
- drb (2.2.1)
82
+ drb (2.2.3)
83
+ erb (5.0.2)
86
84
  erubi (1.13.1)
87
85
  globalid (1.2.1)
88
86
  activesupport (>= 6.1)
89
- hashdiff (1.1.2)
87
+ hashdiff (1.2.1)
90
88
  http-accept (1.7.0)
91
89
  http-cookie (1.0.8)
92
90
  domain_name (~> 0.5)
93
91
  i18n (1.14.7)
94
92
  concurrent-ruby (~> 1.0)
95
- io-console (0.8.0)
96
- irb (1.15.1)
93
+ io-console (0.8.1)
94
+ irb (1.15.2)
97
95
  pp (>= 0.6.0)
98
96
  rdoc (>= 4.0.0)
99
97
  reline (>= 0.4.2)
100
- jaro_winkler (1.6.0)
101
- json (2.10.2)
98
+ jaro_winkler (1.6.1)
99
+ json (2.13.2)
102
100
  kramdown (2.5.1)
103
101
  rexml (>= 3.3.9)
104
102
  kramdown-parser-gfm (1.1.0)
105
103
  kramdown (~> 2.0)
106
- language_server-protocol (3.17.0.4)
104
+ language_server-protocol (3.17.0.5)
107
105
  lint_roller (1.1.0)
108
- logger (1.6.6)
109
- loofah (2.24.0)
106
+ logger (1.7.0)
107
+ loofah (2.24.1)
110
108
  crass (~> 1.0.2)
111
109
  nokogiri (>= 1.12.0)
112
110
  mail (2.8.1)
@@ -115,14 +113,13 @@ GEM
115
113
  net-pop
116
114
  net-smtp
117
115
  method_source (1.1.0)
118
- mime-types (3.6.1)
116
+ mime-types (3.7.0)
119
117
  logger
120
- mime-types-data (~> 3.2015)
121
- mime-types-data (3.2025.0318)
118
+ mime-types-data (~> 3.2025, >= 3.2025.0507)
119
+ mime-types-data (3.2025.0916)
122
120
  mini_mime (1.1.5)
123
121
  minitest (5.25.5)
124
- mutex_m (0.3.0)
125
- net-imap (0.4.19)
122
+ net-imap (0.4.22)
126
123
  date
127
124
  net-protocol
128
125
  net-pop (0.1.2)
@@ -132,33 +129,35 @@ GEM
132
129
  net-smtp (0.5.1)
133
130
  net-protocol
134
131
  netrc (0.11.0)
135
- nokogiri (1.17.2-arm64-darwin)
132
+ nokogiri (1.18.10-arm64-darwin)
136
133
  racc (~> 1.4)
137
134
  observer (0.1.2)
135
+ open3 (0.2.1)
138
136
  optparse (0.6.0)
139
- ostruct (0.6.1)
140
- parallel (1.26.3)
141
- parser (3.3.7.2)
137
+ ostruct (0.6.3)
138
+ parallel (1.27.0)
139
+ parser (3.3.9.0)
142
140
  ast (~> 2.4.1)
143
141
  racc
144
142
  pp (0.6.2)
145
143
  prettyprint
146
144
  prettyprint (0.2.0)
147
- profile-viewer (0.0.4)
145
+ prism (1.5.1)
146
+ profile-viewer (0.0.5)
148
147
  optparse
149
148
  webrick
150
- pry (0.14.2)
149
+ pry (0.15.2)
151
150
  coderay (~> 1.1)
152
151
  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)
152
+ pry-byebug (3.11.0)
153
+ byebug (~> 12.0)
154
+ pry (>= 0.13, < 0.16)
155
+ psych (5.2.6)
157
156
  date
158
157
  stringio
159
- public_suffix (6.0.1)
158
+ public_suffix (6.0.2)
160
159
  racc (1.8.1)
161
- rack (2.2.13)
160
+ rack (2.2.17)
162
161
  rack-session (1.0.2)
163
162
  rack (< 3)
164
163
  rack-test (1.1.0)
@@ -166,31 +165,32 @@ GEM
166
165
  rackup (1.0.1)
167
166
  rack (< 3)
168
167
  webrick
169
- rails-dom-testing (2.2.0)
168
+ rails-dom-testing (2.3.0)
170
169
  activesupport (>= 5.0.0)
171
170
  minitest
172
171
  nokogiri (>= 1.6)
173
172
  rails-html-sanitizer (1.6.2)
174
173
  loofah (~> 2.21)
175
174
  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
175
+ railties (8.0.2.1)
176
+ actionpack (= 8.0.2.1)
177
+ activesupport (= 8.0.2.1)
178
+ irb (~> 1.13)
180
179
  rackup (>= 1.0.0)
181
180
  rake (>= 12.2)
182
181
  thor (~> 1.0, >= 1.2.2)
183
182
  zeitwerk (~> 2.6)
184
183
  rainbow (3.1.1)
185
- rake (13.2.1)
186
- rbs (3.6.1)
184
+ rake (13.3.0)
185
+ rbs (3.9.5)
187
186
  logger
188
- rdoc (6.12.0)
187
+ rdoc (6.14.2)
188
+ erb
189
189
  psych (>= 4.0.0)
190
- redis-client (0.24.0)
190
+ redis-client (0.25.3)
191
191
  connection_pool
192
- regexp_parser (2.10.0)
193
- reline (0.6.0)
192
+ regexp_parser (2.11.3)
193
+ reline (0.6.2)
194
194
  io-console (~> 0.5)
195
195
  rest-client (2.1.0)
196
196
  http-accept (>= 1.7.0, < 2.0)
@@ -199,34 +199,34 @@ GEM
199
199
  netrc (~> 0.8)
200
200
  reverse_markdown (3.0.0)
201
201
  nokogiri
202
- rexml (3.4.1)
203
- rspec (3.13.0)
202
+ rexml (3.4.4)
203
+ rspec (3.13.1)
204
204
  rspec-core (~> 3.13.0)
205
205
  rspec-expectations (~> 3.13.0)
206
206
  rspec-mocks (~> 3.13.0)
207
- rspec-core (3.13.3)
207
+ rspec-core (3.13.5)
208
208
  rspec-support (~> 3.13.0)
209
- rspec-expectations (3.13.3)
209
+ rspec-expectations (3.13.5)
210
210
  diff-lcs (>= 1.2.0, < 2.0)
211
211
  rspec-support (~> 3.13.0)
212
- rspec-mocks (3.13.2)
212
+ rspec-mocks (3.13.5)
213
213
  diff-lcs (>= 1.2.0, < 2.0)
214
214
  rspec-support (~> 3.13.0)
215
- rspec-rails (7.1.1)
216
- actionpack (>= 7.0)
217
- activesupport (>= 7.0)
218
- railties (>= 7.0)
215
+ rspec-rails (8.0.2)
216
+ actionpack (>= 7.2)
217
+ activesupport (>= 7.2)
218
+ railties (>= 7.2)
219
219
  rspec-core (~> 3.13)
220
220
  rspec-expectations (~> 3.13)
221
221
  rspec-mocks (~> 3.13)
222
222
  rspec-support (~> 3.13)
223
- rspec-sidekiq (5.1.0)
223
+ rspec-sidekiq (5.2.0)
224
224
  rspec-core (~> 3.0)
225
225
  rspec-expectations (~> 3.0)
226
226
  rspec-mocks (~> 3.0)
227
227
  sidekiq (>= 5, < 9)
228
- rspec-support (3.13.2)
229
- rubocop (1.74.0)
228
+ rspec-support (3.13.6)
229
+ rubocop (1.80.2)
230
230
  json (~> 2.3)
231
231
  language_server-protocol (~> 3.17.0.2)
232
232
  lint_roller (~> 1.1.0)
@@ -234,14 +234,19 @@ GEM
234
234
  parser (>= 3.3.0.2)
235
235
  rainbow (>= 2.2.2, < 4.0)
236
236
  regexp_parser (>= 2.9.3, < 3.0)
237
- rubocop-ast (>= 1.38.0, < 2.0)
237
+ rubocop-ast (>= 1.46.0, < 2.0)
238
238
  ruby-progressbar (~> 1.7)
239
239
  unicode-display_width (>= 2.4.0, < 4.0)
240
- rubocop-ast (1.41.0)
240
+ rubocop-ast (1.46.0)
241
241
  parser (>= 3.3.7.2)
242
+ prism (~> 1.4)
243
+ rubocop-yard (1.0.0)
244
+ lint_roller
245
+ rubocop (~> 1.72)
246
+ yard
242
247
  ruby-progressbar (1.13.0)
243
- securerandom (0.3.2)
244
- shoulda-matchers (6.4.0)
248
+ securerandom (0.4.1)
249
+ shoulda-matchers (6.5.0)
245
250
  activesupport (>= 5.2.0)
246
251
  sidekiq (7.3.9)
247
252
  base64
@@ -253,50 +258,63 @@ GEM
253
258
  docile (~> 1.1)
254
259
  simplecov-html (~> 0.11)
255
260
  simplecov_json_formatter (~> 0.1)
256
- simplecov-cobertura (2.1.0)
261
+ simplecov-cobertura (3.1.0)
257
262
  rexml
258
263
  simplecov (~> 0.19)
259
- simplecov-html (0.13.1)
264
+ simplecov-html (0.13.2)
260
265
  simplecov_json_formatter (0.1.4)
261
- solargraph (0.52.0)
266
+ solargraph (0.57.0)
267
+ ast (~> 2.4.3)
262
268
  backport (~> 1.2)
263
- benchmark
269
+ benchmark (~> 0.4)
264
270
  bundler (~> 2.0)
265
271
  diff-lcs (~> 1.4)
266
- jaro_winkler (~> 1.6)
272
+ jaro_winkler (~> 1.6, >= 1.6.1)
267
273
  kramdown (~> 2.3)
268
274
  kramdown-parser-gfm (~> 1.1)
269
275
  logger (~> 1.6)
270
276
  observer (~> 0.1)
277
+ open3 (~> 0.2.1)
271
278
  ostruct (~> 0.6)
272
279
  parser (~> 3.0)
273
- rbs (~> 3.0)
274
- reverse_markdown (>= 2.0, < 4)
275
- rubocop (~> 1.38)
280
+ prism (~> 1.4)
281
+ rbs (>= 3.6.1, <= 4.0.0.dev.4)
282
+ reverse_markdown (~> 3.0)
283
+ rubocop (~> 1.76)
276
284
  thor (~> 1.0)
277
285
  tilt (~> 2.0)
278
286
  yard (~> 0.9, >= 0.9.24)
287
+ yard-activesupport-concern (~> 0.0)
279
288
  yard-solargraph (~> 0.1)
280
- stringio (3.1.5)
281
- thor (1.3.2)
282
- tilt (2.6.0)
289
+ stringio (3.1.7)
290
+ thor (1.4.0)
291
+ tilt (2.6.1)
283
292
  timeout (0.4.3)
284
293
  tzinfo (2.0.6)
285
294
  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)
295
+ unicode-display_width (3.2.0)
296
+ unicode-emoji (~> 4.1)
297
+ unicode-emoji (4.1.0)
298
+ unparser (0.8.0)
299
+ diff-lcs (~> 1.6)
300
+ parser (>= 3.3.0)
301
+ prism (>= 1.4)
302
+ uri (1.0.3)
303
+ useragent (0.16.11)
289
304
  webmock (3.25.1)
290
305
  addressable (>= 2.8.0)
291
306
  crack (>= 0.3.2)
292
307
  hashdiff (>= 0.4.0, < 2.0.0)
293
308
  webrick (1.9.1)
294
309
  yard (0.9.37)
310
+ yard-activesupport-concern (0.0.1)
311
+ yard (>= 0.8)
295
312
  yard-solargraph (0.1.0)
296
313
  yard (~> 0.9)
297
- zeitwerk (2.6.18)
314
+ zeitwerk (2.7.3)
298
315
 
299
316
  PLATFORMS
317
+ arm64-darwin-22
300
318
  arm64-darwin-24
301
319
 
302
320
  DEPENDENCIES
@@ -305,18 +323,22 @@ DEPENDENCIES
305
323
  appraisal
306
324
  bundler
307
325
  debug
326
+ net-imap (~> 0.4.0)
308
327
  profile-viewer
309
328
  pry-byebug
310
329
  rake
330
+ rbs
311
331
  rspec
312
332
  rspec-rails
313
333
  rspec-sidekiq
314
334
  rubocop
335
+ rubocop-yard
315
336
  shoulda-matchers
316
337
  simplecov
317
338
  simplecov-cobertura
318
339
  solargraph-rspec!
340
+ unparser
319
341
  webmock
320
342
 
321
343
  BUNDLED WITH
322
- 2.3.17
344
+ 2.6.9
@@ -34,12 +34,16 @@ module Solargraph
34
34
 
35
35
  # @return [Array<Symbol>]
36
36
  def additional_let_methods
37
- (rspec_raw_data['let_methods'] || []).map(&:to_sym)
37
+ # @type [Array<String>, nil]
38
+ let_methods = rspec_raw_data['let_methods']
39
+ (let_methods || []).map(&:to_sym)
38
40
  end
39
41
 
40
42
  # @return [Array<Symbol>]
41
43
  def additional_example_methods
42
- (rspec_raw_data['example_methods'] || []).map(&:to_sym)
44
+ # @type [Array<String>, nil]
45
+ example_methods = rspec_raw_data['example_methods']
46
+ (example_methods || []).map(&:to_sym)
43
47
  end
44
48
 
45
49
  # @return [Hash]
@@ -9,7 +9,7 @@ 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
14
 
15
15
  module Solargraph
@@ -78,16 +78,16 @@ module Solargraph
78
78
  filename.include?('spec/')
79
79
  end
80
80
 
81
- # @param yard_map [YardMap]
81
+ # @param _yard_map [YardMap]
82
82
  # @return [Environ]
83
83
  def global(_yard_map)
84
84
  pins = []
85
- pins += Solargraph::Rspec::TestHelpers.include_helper_pins(
85
+ pins += Solargraph::Rspec::Gems.include_helper_pins(
86
86
  root_example_group_namespace_pin: root_example_group_namespace_pin
87
87
  )
88
88
  pins += annotation_pins
89
89
  # TODO: Include gem requires conditionally based on Gemfile definition
90
- requires = Solargraph::Rspec::TestHelpers.gem_names
90
+ requires = Solargraph::Rspec::Gems.gem_names
91
91
 
92
92
  if pins.any?
93
93
  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,45 @@ 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
+ # HACK: We should only rely on public API, and avoid instance_variable_get/set.
71
72
  pin.instance_variable_set('@closure', new_closure)
72
73
  pin.reset_generated!
73
74
 
74
75
  pin.remove_instance_variable(:@path) if pin.instance_variables.include? :@path
75
76
  end
77
+
78
+ # Given the following code, Solargraph::Parser.node_range returns the following range for block ast:
79
+ #
80
+ # ```ruby
81
+ # some_method_with_block do
82
+ # ^ - block start
83
+ # end
84
+ # ^ - block end
85
+ # ```
86
+ #
87
+ # Instead we want the range to be:
88
+ #
89
+ # ```ruby
90
+ # some_method_with_block do
91
+ # ^ - block start
92
+ # end
93
+ # ^ - block end
94
+ # ```
95
+ #
96
+ # @param closure [Solargraph::Pin::Closure]
97
+ # @param source_map [Solargraph::SourceMap]
98
+ # @return [void]
99
+ def override_block_location(closure, source_map)
100
+ range = closure.location.range
101
+ block_ast = source_map.source.node_at(range.ending.line, range.ending.column)
102
+ new_location = PinFactory.build_location(
103
+ PinFactory.build_location_range(block_ast),
104
+ closure.location.filename
105
+ )
106
+
107
+ # HACK: We should only rely on public API, and avoid instance_variable_get/set.
108
+ closure.instance_variable_set('@location', new_location)
109
+ end
76
110
  end
77
111
  end
78
112
  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)
@@ -2,16 +2,15 @@
2
2
 
3
3
  module Solargraph
4
4
  module Rspec
5
- class TestHelpers
6
- class GemHelpers < Struct.new(:required_gems, :helper_modules, keyword_init: true)
7
- # @!attribute [r] required_gems
8
- # @return [Array<String>]
9
- # @!attribute [r] helper_modules
10
- # @return [Array<String>]
11
- end
5
+ class Gems
6
+ # rubocop:disable YARD/MeaninglessTag
7
+ # @param required_gems [Array<String>]
8
+ # @param helper_modules [Array<String>]
9
+ # rubocop:enable YARD/MeaninglessTag
10
+ GemHelpers = Struct.new(:required_gems, :helper_modules, keyword_init: true)
12
11
 
13
12
  class << self
14
- # @return [String]
13
+ # @return [Array<String>]
15
14
  def gem_names
16
15
  GEM_HELPERS.flat_map(&:required_gems)
17
16
  end
@@ -37,7 +36,7 @@ module Solargraph
37
36
 
38
37
  GEM_HELPERS = [
39
38
  GemHelpers.new(
40
- required_gems: %w[rspec],
39
+ required_gems: %w[rspec rspec-expectations rspec-core],
41
40
  helper_modules: %w[RSpec::Matchers]
42
41
  ),
43
42
  # https://github.com/rspec/rspec-mocks
@@ -48,7 +47,7 @@ module Solargraph
48
47
  # @see https://github.com/rspec/rspec-rails#what-tests-should-i-write
49
48
  # @see https://github.com/rspec/rspec-rails#helpful-rails-matchers
50
49
  GemHelpers.new(
51
- required_gems: %w[rspec-rails actionmailer activesupport activerecord],
50
+ required_gems: %w[rspec-rails actionmailer activesupport actionpack],
52
51
  helper_modules: [
53
52
  'RSpec::Rails::Matchers',
54
53
  'ActionController::TestCase::Behavior',
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Credits: This file was originally copied and adapted from the log_bench gem.
3
+ # Credits: This file was originally copied and adapted from the solargraph-rails gem.
4
4
 
5
5
  module Solargraph
6
6
  module Rspec
@@ -8,11 +8,12 @@ module Solargraph
8
8
  module PinFactory
9
9
  # @param namespace [Solargraph::Pin::Namespace]
10
10
  # @param name [String]
11
- # @param types [Array<String>]
12
- # @param location [Solargraph::Location]
11
+ # @param types [Array<String>, nil]
12
+ # @param [Parser::AST::Node, nil] node
13
+ # @param location [Solargraph::Location, nil]
13
14
  # @param comments [Array<String>]
14
15
  # @param attribute [Boolean]
15
- # @param scope [:instance, :class]
16
+ # @param scope [:instance, :class] # rubocop:disable YARD/TagTypeSyntax
16
17
  # @return [Solargraph::Pin::Method]
17
18
  def self.build_public_method(
18
19
  namespace,
@@ -42,7 +43,7 @@ module Solargraph
42
43
  end
43
44
 
44
45
  # @param namespace [Solargraph::Pin::Namespace]
45
- # @param name [String]
46
+ # @param module_name [String]
46
47
  # @param location [Solargraph::Location]
47
48
  # @return [Solargraph::Pin::Reference::Include]
48
49
  def self.build_module_include(namespace, module_name, location)
@@ -74,10 +75,36 @@ module Solargraph
74
75
  )
75
76
  end
76
77
 
78
+ # Given the following code, Solargraph::Parser.node_range returns the following range for block ast:
79
+ #
80
+ # some_method_with_block do
81
+ # ^ - block start
82
+ # end
83
+ # ^ - block end
84
+ #
85
+ # Instead we want the range to be:
86
+ #
87
+ # some_method_with_block do
88
+ # ^ - block start
89
+ # end
90
+ # ^ - block end
91
+ #
77
92
  # @param ast [::Parser::AST::Node]
78
93
  # @return [Solargraph::Range]
79
94
  def self.build_location_range(ast)
80
- Solargraph::Parser.node_range(ast)
95
+ if ast.type == :block
96
+ method_range = Solargraph::Parser.node_range(ast.children[0])
97
+ full_block_range = Solargraph::Parser.node_range(ast)
98
+
99
+ Solargraph::Range.from_to(
100
+ method_range.ending.line,
101
+ method_range.ending.character,
102
+ full_block_range.ending.line,
103
+ full_block_range.ending.character
104
+ )
105
+ else
106
+ Solargraph::Parser.node_range(ast)
107
+ end
81
108
  end
82
109
 
83
110
  # @param location_range [Solargraph::Range]
@@ -11,6 +11,7 @@ module Solargraph
11
11
  # Transforms let block to method ast node
12
12
  # @param block_ast [::Parser::AST::Node]
13
13
  # @return [::Parser::AST::Node, nil]
14
+ # @param [String, nil] method_name
14
15
  def transform_block(block_ast, method_name = nil)
15
16
  method_name ||= NodeTypes.let_method_name(block_ast)
16
17
 
@@ -22,11 +23,6 @@ module Solargraph
22
23
  block_ast.children[2]
23
24
  ]
24
25
  )
25
- rescue SyntaxError => e
26
- Solargraph.logger.warn "[RSpec] Failed to build fake let method: #{e.message}, \
27
- \n\nlet_definition_code: \n```\n#{let_definition_code}\n```, \
28
- \n\nmethod_body: \n```\n#{method_body}\n```, \
29
- \nast: #{block_ast.inspect}"
30
26
  end
31
27
  end
32
28
  end
@@ -10,38 +10,40 @@ module Solargraph
10
10
  ast.is_a?(::Parser::AST::Node) && ast.type == :block
11
11
  end
12
12
 
13
- # @param ast [::Parser::AST::Node]
13
+ # @param block_ast [::Parser::AST::Node]
14
14
  # @return [Boolean]
15
15
  def self.a_context_block?(block_ast)
16
16
  Solargraph::Rspec::CONTEXT_METHODS.include?(method_with_block_name(block_ast))
17
17
  end
18
18
 
19
- # @param ast [::Parser::AST::Node]
19
+ # @param block_ast [::Parser::AST::Node]
20
20
  # @return [Boolean]
21
21
  def self.a_subject_block?(block_ast)
22
22
  Solargraph::Rspec::SUBJECT_METHODS.include?(method_with_block_name(block_ast))
23
23
  end
24
24
 
25
- # @param ast [::Parser::AST::Node]
25
+ # @param block_ast [::Parser::AST::Node]
26
26
  # @param config [Config]
27
27
  # @return [Boolean]
28
28
  def self.a_example_block?(block_ast, config)
29
29
  config.example_methods.map(&:to_s).include?(method_with_block_name(block_ast))
30
30
  end
31
31
 
32
- # @param ast [::Parser::AST::Node]
32
+ # @param block_ast [::Parser::AST::Node]
33
33
  # @param config [Config]
34
34
  # @return [Boolean]
35
35
  def self.a_let_block?(block_ast, config)
36
36
  config.let_methods.map(&:to_s).include?(method_with_block_name(block_ast))
37
37
  end
38
38
 
39
- # @param ast [::Parser::AST::Node]
39
+ # @param block_ast [::Parser::AST::Node]
40
40
  # @return [Boolean]
41
41
  def self.a_hook_block?(block_ast)
42
42
  Solargraph::Rspec::HOOK_METHODS.include?(method_with_block_name(block_ast))
43
43
  end
44
44
 
45
+ # @param [::Parser::AST::Node] ast
46
+ # @return [Boolean]
45
47
  def self.a_constant?(ast)
46
48
  ast.type == :const
47
49
  end
@@ -56,7 +58,7 @@ module Solargraph
56
58
  end
57
59
 
58
60
  # @param block_ast [::Parser::AST::Node]
59
- # @return [::Parser::AST::Node]
61
+ # @return [::Parser::AST::Node, nil]
60
62
  def self.context_description_node(block_ast)
61
63
  return nil unless a_context_block?(block_ast)
62
64
 
@@ -64,7 +66,7 @@ module Solargraph
64
66
  end
65
67
 
66
68
  # @param block_ast [::Parser::AST::Node]
67
- # @return [String]
69
+ # @return [String, nil]
68
70
  def self.let_method_name(block_ast)
69
71
  return nil unless a_block?(block_ast)
70
72
 
@@ -26,7 +26,7 @@ module Solargraph
26
26
  private
27
27
 
28
28
  # @see https://github.com/rspec/rspec-core/blob/1eeadce5aa7137ead054783c31ff35cbfe9d07cc/lib/rspec/core/example_group.rb#L862
29
- # @param ast [Parser::AST::Node]
29
+ # @param string_ast [Parser::AST::Node]
30
30
  # @return [String]
31
31
  def string_to_const_name(string_ast)
32
32
  return unless string_ast.type == :str
@@ -188,8 +188,9 @@ module Solargraph
188
188
  end
189
189
 
190
190
  # Find all describe/context blocks in the AST.
191
- # @param ast [Parser::AST::Node]
192
191
  # @yield [String, Parser::AST::Node]
192
+ # @param [Parser::AST::Node] ast
193
+ # @param [String] root_namespace
193
194
  def each_context_block(ast, root_namespace = Rspec::ROOT_NAMESPACE, &block)
194
195
  each_block(ast, root_namespace) do |block_ast, parent_namespace|
195
196
  is_a_context = NodeTypes.a_context_block?(block_ast)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Solargraph
4
4
  module Rspec
5
- VERSION = '0.5.4'
5
+ VERSION = '0.5.5'
6
6
  end
7
7
  end
@@ -54,6 +54,7 @@ module Solargraph
54
54
  end
55
55
 
56
56
  # @param children [Array<::Parser::AST::Node>]
57
+ # @param args [Array]
57
58
  def match_children(children, args = @args)
58
59
  args.each_with_index.all? do |arg, i|
59
60
  if arg == :any
@@ -0,0 +1,20 @@
1
+
2
+ # Download sources
3
+ sources:
4
+ - type: git
5
+ name: ruby/gem_rbs_collection
6
+ remote: https://github.com/ruby/gem_rbs_collection.git
7
+ revision: main
8
+ repo_dir: gems
9
+
10
+ # You can specify local directories as sources also.
11
+ # - type: local
12
+ # path: path/to/your/local/repository
13
+
14
+ # A directory to install the downloaded RBSs
15
+ path: .gem_rbs_collection
16
+
17
+ # gems:
18
+ # # If you want to avoid installing rbs files for gems, you can specify them here.
19
+ # - name: GEM_NAME
20
+ # ignore: true
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solargraph-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lekë Mula
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-09-06 00:00:00.000000000 Z
10
+ date: 2025-10-05 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: solargraph
@@ -33,6 +33,7 @@ extra_rdoc_files: []
33
33
  files:
34
34
  - ".rspec"
35
35
  - ".rubocop.yml"
36
+ - ".solargraph.yml.example"
36
37
  - Appraisals
37
38
  - CHANGELOG.md
38
39
  - CODE_OF_CONDUCT.md
@@ -54,16 +55,17 @@ files:
54
55
  - lib/solargraph/rspec/correctors/example_and_hook_blocks_binding_corrector.rb
55
56
  - lib/solargraph/rspec/correctors/let_methods_corrector.rb
56
57
  - lib/solargraph/rspec/correctors/subject_method_corrector.rb
58
+ - lib/solargraph/rspec/gems.rb
57
59
  - lib/solargraph/rspec/pin_factory.rb
58
60
  - lib/solargraph/rspec/spec_walker.rb
59
61
  - lib/solargraph/rspec/spec_walker/fake_let_method.rb
60
62
  - lib/solargraph/rspec/spec_walker/full_constant_name.rb
61
63
  - lib/solargraph/rspec/spec_walker/node_types.rb
62
64
  - lib/solargraph/rspec/spec_walker/rspec_context_namespace.rb
63
- - lib/solargraph/rspec/test_helpers.rb
64
65
  - lib/solargraph/rspec/version.rb
65
66
  - lib/solargraph/rspec/walker.rb
66
67
  - lib/solargraph_rspec.rb
68
+ - rbs_collection.yaml
67
69
  - release_gem.sh
68
70
  - sig/solargraph/rspec.rbs
69
71
  - solargraph-rspec.gemspec