solargraph-rspec 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +13 -0
- data/lib/solargraph/rspec/config.rb +10 -0
- data/lib/solargraph/rspec/spec_walker/node_types.rb +3 -2
- data/lib/solargraph/rspec/spec_walker.rb +1 -1
- data/lib/solargraph/rspec/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb5a5e8955a55b4b936e0f7ac8b75daeddd08cc5eed9230b5706054398384480
|
4
|
+
data.tar.gz: bb897224942929755a8b9aebbc224bed114393f05b66115299b545a401b4bcdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60902200d9a6574fe1313b51e270e568273fca41200e9dfbfdcd1f5529f6e95d3cda1e23b1eb303ab1be524048b23c435958590b29f2a9aab6083c0db788d55f
|
7
|
+
data.tar.gz: 405dce9b2d8b0621a66486d6840969cc635754bdbb40e0d1ec2b142cd48c11afa863f0e463afc47c3387f4ed264a607fec981d2df2fe0f15de9f37cc450445e0
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
Add here...
|
11
|
+
|
12
|
+
## v0.3.0 - 2024-07-10
|
13
|
+
|
14
|
+
### Added
|
15
|
+
|
16
|
+
- Added `example_methods` as a configuration option to add your own example methods. (thanks to [@mskog](https://github.com/mskog) - first code contributor 🎉)
|
17
|
+
|
18
|
+
## v0.2.2 - 2024-06-23
|
19
|
+
|
10
20
|
### Fixed
|
11
21
|
|
12
22
|
- Suggest keeping `spec/**/*` in the `exclude` section of `.solargraph.yml` to avoid performance issues (see [commit](https://github.com/lekemula/solargraph-rspec/commit/3f0fc39e59e99bf9430e55c52ecb88650e49315e))
|
data/README.md
CHANGED
@@ -80,6 +80,19 @@ rspec:
|
|
80
80
|
- let_it_be
|
81
81
|
```
|
82
82
|
|
83
|
+
If you have your own custom `example`-like methods like `it`, you can add them to your `.solargraph.yml` file like this:
|
84
|
+
|
85
|
+
```yaml
|
86
|
+
# .solargraph.yml
|
87
|
+
# ...
|
88
|
+
rspec:
|
89
|
+
example_methods:
|
90
|
+
- my_it
|
91
|
+
```
|
92
|
+
|
93
|
+
This is useful if you use gems like [rspec-given](https://github.com/rspec-given/rspec-given) which introduces its own `let` and `example` methods.
|
94
|
+
|
95
|
+
|
83
96
|
### Gem completions
|
84
97
|
|
85
98
|
Solargraph utilizes the YARD documentation to provide code completion. If you want to have completion for gems in your project, you can generate YARD documentation for them ([Read more](https://solargraph.org/guides/yard)).
|
@@ -20,6 +20,11 @@ module Solargraph
|
|
20
20
|
(Rspec::LET_METHODS + additional_let_methods).map(&:to_sym)
|
21
21
|
end
|
22
22
|
|
23
|
+
# @return [Array<Symbol>]
|
24
|
+
def example_methods
|
25
|
+
(Rspec::EXAMPLE_METHODS + additional_example_methods).map(&:to_sym)
|
26
|
+
end
|
27
|
+
|
23
28
|
private
|
24
29
|
|
25
30
|
# @return [Hash]
|
@@ -32,6 +37,11 @@ module Solargraph
|
|
32
37
|
(rspec_raw_data['let_methods'] || []).map(&:to_sym)
|
33
38
|
end
|
34
39
|
|
40
|
+
# @return [Array<Symbol>]
|
41
|
+
def additional_example_methods
|
42
|
+
(rspec_raw_data['example_methods'] || []).map(&:to_sym)
|
43
|
+
end
|
44
|
+
|
35
45
|
# @return [Hash]
|
36
46
|
def raw_data
|
37
47
|
@solargraph_config.raw_data
|
@@ -25,9 +25,10 @@ module Solargraph
|
|
25
25
|
end
|
26
26
|
|
27
27
|
# @param ast [RubyVM::AbstractSyntaxTree::Node]
|
28
|
+
# @param config [Config]
|
28
29
|
# @return [Boolean]
|
29
|
-
def self.a_example_block?(block_ast)
|
30
|
-
|
30
|
+
def self.a_example_block?(block_ast, config)
|
31
|
+
config.example_methods.map(&:to_s).include?(method_with_block_name(block_ast))
|
31
32
|
end
|
32
33
|
|
33
34
|
# @param ast [RubyVM::AbstractSyntaxTree::Node]
|
@@ -138,7 +138,7 @@ module Solargraph
|
|
138
138
|
end
|
139
139
|
|
140
140
|
walker.on :ITER do |block_ast|
|
141
|
-
next unless NodeTypes.a_example_block?(block_ast)
|
141
|
+
next unless NodeTypes.a_example_block?(block_ast, config)
|
142
142
|
|
143
143
|
@handlers[:on_example_block].each do |handler|
|
144
144
|
handler.call(PinFactory.build_location_range(block_ast))
|
metadata
CHANGED
@@ -1,35 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solargraph-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lekë Mula
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: solargraph
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0.49'
|
20
17
|
- - ">="
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: 0.49.0
|
20
|
+
- - "~>"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0.49'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0.49'
|
30
27
|
- - ">="
|
31
28
|
- !ruby/object:Gem::Version
|
32
29
|
version: 0.49.0
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0.49'
|
33
33
|
description: RSpec is a testing tool of choice for many Ruby developers. This plugin
|
34
34
|
provides code completion and other features for RSpec files in Solargraph.
|
35
35
|
email:
|
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
requirements: []
|
92
|
-
rubygems_version: 3.
|
92
|
+
rubygems_version: 3.0.9
|
93
93
|
signing_key:
|
94
94
|
specification_version: 4
|
95
95
|
summary: Solargraph plugin supporting RSpec code completion
|