ruby-lsp-shoulda-context 0.3.3 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4b10df0b5e20922d4a1fea43701d1d852e1b7cd7c12301d63052fbd0ddd261c
4
- data.tar.gz: b3771e57c473df35dc734f48852800d75a337b2e75ab5f2d0341db6902851749
3
+ metadata.gz: 8112ca7fa20b49f281d1b3b89975e7cab08adbdc93d753daaa0b275423adff19
4
+ data.tar.gz: 7a175a8727300cc49bedf73b82e7263330262e319a8df36083215b4deed11f23
5
5
  SHA512:
6
- metadata.gz: 0aff200cb4d3e4e66af8f63b90ae3ad49aacebc1ceb47f3c1a546aa715a63fb2fd7effe1313183147ad8e55fdddb81d6ab758edf3a085d74ba3c7e4399743481
7
- data.tar.gz: ac3e55b5c6c23f934450c3a3f567b4e5a53eedac8508ee37cb163de856484988a9cfd5adc42471cc873278a58ee30e5e5ba63853bc31730554c72e8eb2ac581c
6
+ metadata.gz: 443dcb56b9542410765f47fc3a22d7135fa09ad71abb6e9d2308eee42566b5854c16564abc2f515e4e0433be5e830d1de5ff18c25b41e6612f6d3991129139dc
7
+ data.tar.gz: 1d9353e3befef9ee4b5f9e7f11cca6e44034fd8cd64c2af0250bacd7716b1113f7eaba9985003a909038c7d2dbddcac021fa5041eb26506c777776a9cdb72833
@@ -11,11 +11,12 @@ module RubyLsp
11
11
 
12
12
  BASE_COMMAND = T.let(
13
13
  begin
14
+ cmd = File.exist?(File.join(Dir.pwd, "bin", "rails")) ? "bin/rails test" : "ruby -ITest"
14
15
  Bundler.with_original_env { Bundler.default_lockfile }
15
- "bundle exec ruby"
16
+ "bundle exec #{cmd}"
16
17
  rescue Bundler::GemfileNotFound
17
- "ruby"
18
- end + " -ITest",
18
+ cmd
19
+ end,
19
20
  String,
20
21
  )
21
22
 
@@ -97,7 +98,7 @@ module RubyLsp
97
98
  add_test_code_lens(
98
99
  node,
99
100
  name: class_name,
100
- kind: :group,
101
+ kind: :class,
101
102
  )
102
103
  end
103
104
 
@@ -147,7 +148,13 @@ module RubyLsp
147
148
  def add_test_code_lens(node, name:, kind:)
148
149
  return unless DependencyDetector.instance.dependencies.include?(REQUIRED_LIBRARY)
149
150
 
150
- command = "#{@base_command} #{@path} -n \"/#{@pattern.strip}/\""
151
+ if kind == :class
152
+ pattern = "#{@class_name}Test"
153
+ kind = :group
154
+ else
155
+ pattern = @pattern.strip
156
+ end
157
+ command = "#{@base_command} #{@path} --name \"/#{pattern}/\""
151
158
 
152
159
  grouping_data = { group_id: @group_id_stack.last, kind: kind }
153
160
  grouping_data[:id] = @group_id if kind == :group
@@ -3,6 +3,6 @@
3
3
 
4
4
  module RubyLsp
5
5
  module ShouldaContext
6
- VERSION = "0.3.3"
6
+ VERSION = "0.4.0"
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-lsp-shoulda-context
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Domingo Edwards
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-10 00:00:00.000000000 Z
11
+ date: 2024-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-lsp