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.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/.rubocop.yml +6 -4
- data/.solargraph.yml.example +26 -0
- data/Appraisals +7 -0
- data/CHANGELOG.md +36 -1
- data/README.md +26 -23
- data/gemfiles/default.gemfile +10 -9
- data/gemfiles/default.gemfile.lock +152 -107
- data/lib/solargraph/rspec/config.rb +26 -2
- data/lib/solargraph/rspec/convention.rb +13 -4
- data/lib/solargraph/rspec/correctors/base.rb +51 -1
- data/lib/solargraph/rspec/correctors/context_block_namespace_corrector.rb +1 -0
- data/lib/solargraph/rspec/correctors/described_class_corrector.rb +1 -1
- data/lib/solargraph/rspec/correctors/example_and_hook_blocks_binding_corrector.rb +1 -0
- data/lib/solargraph/rspec/correctors/let_methods_corrector.rb +2 -1
- data/lib/solargraph/rspec/correctors/subject_method_corrector.rb +2 -2
- data/lib/solargraph/rspec/{test_helpers.rb → gems.rb} +9 -10
- data/lib/solargraph/rspec/pin_factory.rb +33 -6
- data/lib/solargraph/rspec/rspec_configure.rb +67 -0
- data/lib/solargraph/rspec/spec_configuration_walker.rb +74 -0
- data/lib/solargraph/rspec/spec_walker/fake_let_method.rb +1 -5
- data/lib/solargraph/rspec/spec_walker/node_types.rb +9 -7
- data/lib/solargraph/rspec/spec_walker/rspec_context_namespace.rb +1 -1
- data/lib/solargraph/rspec/spec_walker.rb +2 -1
- data/lib/solargraph/rspec/version.rb +1 -1
- data/lib/solargraph/rspec/walker.rb +1 -0
- data/rbs_collection.yaml +20 -0
- metadata +12 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f5479aea692e6eb35870d21e537641872b30e6bdfe8a868110d79488f84c4964
|
|
4
|
+
data.tar.gz: 4c8bfb43f8dececdfe0d19b9c50a963e487caa0c623a020c67f82f0a83f55b7a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c098385b10b165f9619f0e64a0ad01b5da028fcd9e0f90a028f48132438d29af1394967492d2de9a964d66da98bcd6a8a66207af7d8903a853aca6ad3e52d86f
|
|
7
|
+
data.tar.gz: cf40aae6cb2777d1314bf6c510e4f38c2227f43b2bde6db5b3ed4144358775151c17f4a95970da9d0a9fcb295b0305b6226c11472e25e5ec6cf49e8e56fd772c
|
data/.rspec
CHANGED
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'
|
|
7
|
+
gem 'airborne'
|
|
8
|
+
gem 'rspec-rails', '>= 7'
|
|
9
|
+
gem 'rspec-sidekiq'
|
|
10
|
+
gem 'shoulda-matchers'
|
|
11
|
+
gem 'webmock'
|
|
5
12
|
end
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,41 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.6.0] - 2026-08-12
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Add Rspec included modules support by @ShadiestGoat in #32
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- Chore: Test solargraph prereleases (#31)
|
|
17
|
+
- Chore: More reliable closure and location updates by @apiology in #30
|
|
18
|
+
- Chore: Less limiting of gem pin processing in specs by @apiology in #29
|
|
19
|
+
Avoid inference from literal values by @castwide (#34)
|
|
20
|
+
- Chore: fix failing specs (#35)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## [0.5.5] - 2025-10-05
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
- Go-to-defintion/Hover for RSpec DSL methods (eg. context or it)
|
|
27
|
+
|
|
28
|
+
### Other Changes
|
|
29
|
+
- Chore: Add rubocop-yard by @lekemula in #20
|
|
30
|
+
- Chore: Add CI solargraph typecheck step by @lekemula in #21
|
|
31
|
+
- Chore: Adjust specs/CI for next solargraph release after 0.56.2 by @lekemula in #22
|
|
32
|
+
- Chore: Improve CI speed by @lekemula in #23
|
|
33
|
+
- Chore: Improve tests speed by @lekemula in #24
|
|
34
|
+
- Chore: Update testing steps in developer documentation by @apiology in #25
|
|
35
|
+
- Chore: Move 3rd party gems to Appraisals by @lekemula in #27
|
|
36
|
+
|
|
37
|
+
### Changed
|
|
38
|
+
- Update testing steps in developer documentation
|
|
39
|
+
|
|
40
|
+
## [0.5.4] - 2025-09-06
|
|
41
|
+
|
|
42
|
+
### Fixed
|
|
43
|
+
- Fix breaking of solargraph rubocop diagnostics by @lekemula in #19
|
|
44
|
+
|
|
10
45
|
## [0.5.3] - 2025-09-02
|
|
11
46
|
|
|
12
47
|
### Fixed
|
|
@@ -125,7 +160,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
125
160
|
### Added
|
|
126
161
|
|
|
127
162
|
- `describe` and `it` methods completion
|
|
128
|
-
- memoized `let` and `let!` methods completion
|
|
163
|
+
- memoized `let` and `let!` methods completion
|
|
129
164
|
- implicit and explicit `subject` methods
|
|
130
165
|
- `described_class` with appropriate type inference
|
|
131
166
|
- `RSpec::Matchers` methods completion
|
data/README.md
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
[](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
|
|
@@ -77,27 +77,25 @@ Add `solargraph-rspec` to your `.solargraph.yml` as a plugin.
|
|
|
77
77
|
```
|
|
78
78
|
### Configuration
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
You can customize the plugin behavior in your `.solargraph.yml`:
|
|
81
81
|
|
|
82
82
|
```yaml
|
|
83
83
|
# .solargraph.yml
|
|
84
84
|
# ...
|
|
85
85
|
rspec:
|
|
86
|
+
# Custom let-like memoized methods (e.g., from rspec-given, test-prof)
|
|
86
87
|
let_methods:
|
|
87
88
|
- let_it_be
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
If you have your own custom `example`-like methods like `it`, you can add them to your `.solargraph.yml` file like this:
|
|
91
89
|
|
|
92
|
-
|
|
93
|
-
# .solargraph.yml
|
|
94
|
-
# ...
|
|
95
|
-
rspec:
|
|
90
|
+
# Custom example-like methods (e.g., from rspec-given)
|
|
96
91
|
example_methods:
|
|
97
92
|
- my_it
|
|
98
|
-
```
|
|
99
93
|
|
|
100
|
-
|
|
94
|
+
# RSpec helper files to analyze for included modules (shared contexts, custom matchers)
|
|
95
|
+
config_helper_files:
|
|
96
|
+
- spec/spec_helper.rb
|
|
97
|
+
- spec/rails_helper.rb
|
|
98
|
+
```
|
|
101
99
|
|
|
102
100
|
|
|
103
101
|
### Gem completions
|
|
@@ -110,7 +108,7 @@ Run `yard config --gem-install-yri` to generate YARD documentation automatically
|
|
|
110
108
|
|
|
111
109
|
## Acknowledgements
|
|
112
110
|
|
|
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.
|
|
111
|
+
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
112
|
|
|
115
113
|
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
114
|
|
|
@@ -128,17 +126,22 @@ It's codebase IMO is an exemplary of how Ruby code written in a very simple PORO
|
|
|
128
126
|
|
|
129
127
|
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
128
|
|
|
131
|
-
Contributing is easy
|
|
129
|
+
Contributing is easy - note that this Gem uses 'appraisal' to test against RSpec 3rd party plugins without adding to the main `Gemfile`:
|
|
132
130
|
1. Create a fork and clone it
|
|
133
|
-
2.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
131
|
+
2. Verify tests are green:
|
|
132
|
+
```sh
|
|
133
|
+
bundle install
|
|
134
|
+
bundle exec appraisal install
|
|
135
|
+
cp .solargraph.yml.example .solargraph.yml
|
|
136
|
+
bundle exec appraisal bundle exec rbs collection update
|
|
137
|
+
bundle exec appraisal bundle exec solargraph gems $(bundle exec appraisal bundle exec ruby -r './lib/solargraph-rspec' -e 'puts Solargraph::Rspec::Gems.gem_names.join(" ")' 2>/dev/null | tail -n1)
|
|
138
|
+
bundle exec appraisal rspec
|
|
139
|
+
```
|
|
140
|
+
3. Introduce your awesome changes
|
|
141
|
+
4. Ensure they are well covered with tests
|
|
142
|
+
5. Record your changes in the [CHANGELOG.md](./CHANGELOG.md)
|
|
143
|
+
6. Submit a pull request :rocket:
|
|
140
144
|
|
|
141
145
|
## License
|
|
142
146
|
|
|
143
147
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
144
|
-
|
data/gemfiles/default.gemfile
CHANGED
|
@@ -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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
end
|
|
17
|
+
gem "unparser"
|
|
18
|
+
gem "net-imap", "~> 0.4.0"
|
|
19
|
+
gem "actionmailer", ">= 7"
|
|
20
|
+
gem "airborne"
|
|
21
|
+
gem "rspec-rails", ">= 7"
|
|
22
|
+
gem "rspec-sidekiq"
|
|
23
|
+
gem "shoulda-matchers"
|
|
24
|
+
gem "webmock"
|
|
24
25
|
|
|
25
26
|
gemspec path: "../"
|