Commit 514a20e
Account for module wrapping Minitest specs (#3715)
### Motivation
Closes #3712
When we find no test classes, we were considering the describe groups to start at index 1 in our stack of test groups. If you have a module wrapping those specs, that won't be true as there will be a corresponding `nil` entry in the stack (which we use to balance the stack).
We need to search for what is actually the first index to account for this possibility.
### Implementation
Started searching for what is the first spec group, rather than assuming that it's always the first one. I also moved our `in_spec_context?` check since we want to allow the `describe` to be discovered even if the nesting is not empty and we haven't yet found a spec group (which is what happens when there's only a top level module).
### Automated Tests
Added a test that reproduces the scenario.1 parent aad683a commit 514a20e
File tree
2 files changed
+35
-6
lines changed- lib/ruby_lsp/listeners
- test/requests
2 files changed
+35
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
63 | 61 | | |
64 | 62 | | |
65 | 63 | | |
66 | 64 | | |
67 | | - | |
| 65 | + | |
68 | 66 | | |
69 | 67 | | |
70 | 68 | | |
| |||
208 | 206 | | |
209 | 207 | | |
210 | 208 | | |
211 | | - | |
212 | | - | |
| 209 | + | |
| 210 | + | |
213 | 211 | | |
| 212 | + | |
214 | 213 | | |
215 | 214 | | |
216 | | - | |
| 215 | + | |
217 | 216 | | |
218 | 217 | | |
219 | 218 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
792 | 792 | | |
793 | 793 | | |
794 | 794 | | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
795 | 825 | | |
796 | 826 | | |
797 | 827 | | |
| |||
0 commit comments