ruby-lsp-shoulda-context 0.3.1 → 0.3.3
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/Readme.md +1 -0
- data/lib/ruby_lsp/ruby-lsp-shoulda-context/code_lens.rb +14 -4
- data/lib/ruby_lsp/shoulda_context/version.rb +1 -1
- metadata +10 -4
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: f4b10df0b5e20922d4a1fea43701d1d852e1b7cd7c12301d63052fbd0ddd261c
         | 
| 4 | 
            +
              data.tar.gz: b3771e57c473df35dc734f48852800d75a337b2e75ab5f2d0341db6902851749
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 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?
         | 
    
        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. | 
| 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. | 
| 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. | 
| 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. | 
| 74 | 
            +
            rubygems_version: 3.5.6
         | 
| 69 75 | 
             
            signing_key: 
         | 
| 70 76 | 
             
            specification_version: 4
         | 
| 71 77 | 
             
            summary: Ruby LSP shoulda-context
         |