ruby-lsp-shoulda-context 0.3.1 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09ae8206abcee5697a5b709fdb5527c3f764d0c31686d2b39a11c1d3ce346e3b'
4
- data.tar.gz: 0c9a92f7d8411cab5d3967e069e457ef29c449312073f41c5dc69e41bce7d8fd
3
+ metadata.gz: f4b10df0b5e20922d4a1fea43701d1d852e1b7cd7c12301d63052fbd0ddd261c
4
+ data.tar.gz: b3771e57c473df35dc734f48852800d75a337b2e75ab5f2d0341db6902851749
5
5
  SHA512:
6
- metadata.gz: db20a0d41b63d7000b54ada01a178d86391e72f5411cdea8e837a015cae79e87e50eba253785043ae7b24559a7adc4e0d159df973e1e442da8ad8e99aa7dccc9
7
- data.tar.gz: 7d45ec20310b9f0f154d574756f16232957541fadbb846c9f848fb486fdf8a0d82d8e51a084e51e22036ed91a59914eed49d1b714b67f676e602a0f4bcbf878a
6
+ metadata.gz: 0aff200cb4d3e4e66af8f63b90ae3ad49aacebc1ceb47f3c1a546aa715a63fb2fd7effe1313183147ad8e55fdddb81d6ab758edf3a085d74ba3c7e4399743481
7
+ data.tar.gz: ac3e55b5c6c23f934450c3a3f567b4e5a53eedac8508ee37cb163de856484988a9cfd5adc42471cc873278a58ee30e5e5ba63853bc31730554c72e8eb2ac581c
data/Readme.md CHANGED
@@ -44,5 +44,6 @@ Everyone interacting in the RubyLsp::ShouldaContext project's codebases, issue t
44
44
  - [ ] Make exec method conditional to rails or Minitest setup
45
45
  - [x] Make inner context or inner should with collissions with outer DSL not collide using full name of the test (Currently if 2 tests have the same name both are executed)
46
46
  - [x] Provide grouping with classes that ends with "..Test" syntax (Note: The codelens is duplicated becuase lsp support minitest by default and LSP responses are merged)
47
+ - [ ] Provide support for Inner Classes
47
48
 
48
49
  **Note**: This project is in very early stage and could have major bugs
@@ -31,6 +31,7 @@ module RubyLsp
31
31
  @_response = T.let([], ResponseType)
32
32
  # Listener is only initialized if uri.to_standardized_path is valid
33
33
  @path = T.let(T.must(uri.to_standardized_path), String)
34
+ @class_name = T.let("", String)
34
35
  @group_id = T.let(1, Integer)
35
36
  @group_id_stack = T.let([], T::Array[Integer])
36
37
  @pattern = T.let("test_: ", String)
@@ -46,6 +47,12 @@ module RubyLsp
46
47
  case node.message
47
48
  when "should"
48
49
  name = generate_name(node)
50
+
51
+ # If is top level should without context the DSL is different
52
+ if @group_id_stack.length == 1
53
+ @pattern += "#{@class_name} "
54
+ end
55
+
49
56
  @pattern += "should #{name} "
50
57
  add_test_code_lens(node, name: name, kind: :example)
51
58
  when "context"
@@ -65,7 +72,13 @@ module RubyLsp
65
72
  case node.message
66
73
  when "should"
67
74
  name = generate_name(node)
75
+
68
76
  @pattern = remove_last_pattern_in_string(@pattern, "should #{name} ")
77
+
78
+ # If is top level should without context the DSL is different
79
+ if @group_id_stack.length == 1
80
+ @pattern = remove_last_pattern_in_string(@pattern, "#{@class_name} ")
81
+ end
69
82
  when "context"
70
83
  return unless valid_group?(node)
71
84
 
@@ -78,6 +91,7 @@ module RubyLsp
78
91
  sig { params(node: Prism::ClassNode).void }
79
92
  def on_class_node_enter(node)
80
93
  class_name = node.constant_path.slice
94
+ @class_name = remove_last_pattern_in_string(class_name, "Test")
81
95
 
82
96
  if @path && class_name.end_with?("Test")
83
97
  add_test_code_lens(
@@ -102,10 +116,6 @@ module RubyLsp
102
116
  string.sub(/#{pattern}$/, "")
103
117
  end
104
118
 
105
- def pattern_only_has_test?(pattern)
106
- pattern == "test_: "
107
- end
108
-
109
119
  sig { params(node: Prism::CallNode).returns(T::Boolean) }
110
120
  def valid_group?(node)
111
121
  !node.block.nil?
@@ -3,6 +3,6 @@
3
3
 
4
4
  module RubyLsp
5
5
  module ShouldaContext
6
- VERSION = "0.3.1"
6
+ VERSION = "0.3.3"
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-lsp-shoulda-context
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Domingo Edwards
@@ -16,14 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.12.0
19
+ version: 0.13.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 0.14.0
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: 0.12.0
29
+ version: 0.13.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 0.14.0
27
33
  description: An addon for the Ruby LSP that enables shoulda-context testing
28
34
  email:
29
35
  - domingo.edwards@uc.cl
@@ -65,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
71
  - !ruby/object:Gem::Version
66
72
  version: '0'
67
73
  requirements: []
68
- rubygems_version: 3.5.3
74
+ rubygems_version: 3.5.6
69
75
  signing_key:
70
76
  specification_version: 4
71
77
  summary: Ruby LSP shoulda-context