ruby-lsp-shoulda-context 0.3.3 → 0.4.1
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/.env.development +1 -0
- data/CHANGELOG.md +4 -0
- data/Readme.md +6 -5
- data/lib/ruby_lsp/ruby-lsp-shoulda-context/addon.rb +4 -1
- data/lib/ruby_lsp/ruby-lsp-shoulda-context/code_lens.rb +14 -5
- data/lib/ruby_lsp/shoulda_context/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef2bd21652b42fa017e458daa37597860937f8672d23f2deebf021a2530d5b34
|
4
|
+
data.tar.gz: 7cecc4559f69900a160f7649532b9d38696f70a0b29bc9ccc89edd3917d4a459
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fdd797ef37150b665104c90861fd78f1ddc525face38977876acd3edc50d7b5f4f345846b7f6df810d472d56538a307fc1928d3d96b8facda64c8df7cddbddc
|
7
|
+
data.tar.gz: 5486b8f7f137177809cfa9424dfc08909c82320835df82f01b5b23e97732dbad03a5d789c4f72c1e80cca600f9bee6cdd71df68e57cd74122873cc6d10d49bbb
|
data/.env.development
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
RUBY_LSP_SHOULDA_CONTEXT=true
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
## [Unreleased]
|
2
|
+
## [0.4.0] - 2024-02-10
|
3
|
+
- Added support to ruby on rails
|
4
|
+
- Fixed Class Run on terminal whith wrong pattern
|
5
|
+
|
2
6
|
## [0.3.0] - 2024-02-10
|
3
7
|
- Removed collisions from different should/context methods that have the same name at different levels
|
4
8
|
## [0.2.0] - 2024-02-07
|
data/Readme.md
CHANGED
@@ -1,14 +1,15 @@
|
|
1
|
+
[](https://badge.fury.io/rb/ruby-lsp-shoulda-context)
|
2
|
+

|
3
|
+
|
1
4
|
# RubyLsp::ShouldaContext
|
2
5
|
|
3
6
|
This gem provides support for [shoulda-context](https://github.com/thoughtbot/shoulda-context) using [ruby-lsp](https://github.com/Shopify/ruby-lsp/blob/main/lib/rubocop/cop/ruby_lsp/use_register_with_handler_method.rb)
|
4
7
|
|
5
8
|
## Installation
|
6
9
|
|
7
|
-
|
8
|
-
|
9
|
-
Install the gem and add to the application's Gemfile by executing:
|
10
|
+
Add the gem to the application's Gemfile `:development` group:
|
10
11
|
|
11
|
-
|
12
|
+
gem 'ruby-lsp-shoulda-context', '~> 0.4.0', require: false
|
12
13
|
|
13
14
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
14
15
|
|
@@ -41,7 +42,7 @@ Everyone interacting in the RubyLsp::ShouldaContext project's codebases, issue t
|
|
41
42
|
- [x] Make context runnable
|
42
43
|
- [x] Make should with string runnable
|
43
44
|
- [x] Make should with method runnable
|
44
|
-
- [
|
45
|
+
- [x] Make exec method conditional to rails or Minitest setup
|
45
46
|
- [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
47
|
- [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
48
|
- [ ] Provide support for Inner Classes
|
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
require "ruby_lsp/addon"
|
5
5
|
require "ruby_lsp/internal"
|
6
|
+
require "dotenv/load"
|
6
7
|
|
7
8
|
require_relative "code_lens"
|
8
9
|
|
@@ -14,7 +15,9 @@ module RubyLsp
|
|
14
15
|
extend T::Sig
|
15
16
|
|
16
17
|
sig { override.params(message_queue: Thread::Queue).void }
|
17
|
-
def activate(message_queue)
|
18
|
+
def activate(message_queue)
|
19
|
+
Dotenv.load(".env.development.local", ".env.development")
|
20
|
+
end
|
18
21
|
|
19
22
|
sig { override.void }
|
20
23
|
def deactivate; end
|
@@ -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
|
16
|
+
"bundle exec #{cmd}"
|
16
17
|
rescue Bundler::GemfileNotFound
|
17
|
-
|
18
|
-
end
|
18
|
+
cmd
|
19
|
+
end,
|
19
20
|
String,
|
20
21
|
)
|
21
22
|
|
@@ -28,6 +29,8 @@ module RubyLsp
|
|
28
29
|
|
29
30
|
sig { params(uri: URI::Generic, dispatcher: Prism::Dispatcher).void }
|
30
31
|
def initialize(uri, dispatcher)
|
32
|
+
return if ENV["RUBY_LSP_SHOULDA_CONTEXT"] == "false"
|
33
|
+
|
31
34
|
@_response = T.let([], ResponseType)
|
32
35
|
# Listener is only initialized if uri.to_standardized_path is valid
|
33
36
|
@path = T.let(T.must(uri.to_standardized_path), String)
|
@@ -97,7 +100,7 @@ module RubyLsp
|
|
97
100
|
add_test_code_lens(
|
98
101
|
node,
|
99
102
|
name: class_name,
|
100
|
-
kind: :
|
103
|
+
kind: :class,
|
101
104
|
)
|
102
105
|
end
|
103
106
|
|
@@ -147,7 +150,13 @@ module RubyLsp
|
|
147
150
|
def add_test_code_lens(node, name:, kind:)
|
148
151
|
return unless DependencyDetector.instance.dependencies.include?(REQUIRED_LIBRARY)
|
149
152
|
|
150
|
-
|
153
|
+
if kind == :class
|
154
|
+
pattern = "#{@class_name}Test"
|
155
|
+
kind = :group
|
156
|
+
else
|
157
|
+
pattern = @pattern.strip
|
158
|
+
end
|
159
|
+
command = "#{@base_command} #{@path} --name \"/#{pattern}/\""
|
151
160
|
|
152
161
|
grouping_data = { group_id: @group_id_stack.last, kind: kind }
|
153
162
|
grouping_data[:id] = @group_id if kind == :group
|
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.
|
4
|
+
version: 0.4.1
|
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-
|
11
|
+
date: 2024-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-lsp
|
@@ -37,6 +37,7 @@ executables: []
|
|
37
37
|
extensions: []
|
38
38
|
extra_rdoc_files: []
|
39
39
|
files:
|
40
|
+
- ".env.development"
|
40
41
|
- ".rubocop.yml"
|
41
42
|
- ".ruby-version"
|
42
43
|
- CHANGELOG.md
|