class_spec_helper 1.1.0 → 1.1.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/CHANGELOG.md +7 -0
 - data/lib/class_spec_helper/create_classes.rb +12 -2
 - data/lib/class_spec_helper/version.rb +1 -1
 - metadata +6 -6
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 77fafc1edfe0284bb0071806d91869a50796b28873c6477efaa8479517f85e51
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 150badef8cbdd0a239c4d8dd35ccf0c38412111ad1233a75fb6c4a7029280ee4
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: fb049001110324fbfc49d65f9289ffd9110c232e7590c5866097b7d50f922d4bb9c7cec447b679d22dbaa482f364244ab5156f957fff78be219ef19c0ead3978
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 23c0f42608ef65be9e75a95234ef7ec4a34881a3f34504cba5350138380d251d858706cd7146a635936763fdbd91577660d2004d926e045e2f5f0db8aeb5d93a
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,5 +1,12 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # Changelog
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            ## [1.1.1](https://github.com/craigulliott/class_spec_helper/compare/v1.1.0...v1.1.1) (2023-07-17)
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            ### Bug Fixes
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            * can now correctly build the new requested class if it is namespaced within already existing classes ([505b8c9](https://github.com/craigulliott/class_spec_helper/commit/505b8c9e07b3a326ac646c90ebb3b537df9d0981))
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
       3 
10 
     | 
    
         
             
            ## [1.1.0](https://github.com/craigulliott/class_spec_helper/compare/v1.0.0...v1.1.0) (2023-07-17)
         
     | 
| 
       4 
11 
     | 
    
         | 
| 
       5 
12 
     | 
    
         | 
| 
         @@ -36,11 +36,21 @@ class ClassSpecHelper 
     | 
|
| 
       36 
36 
     | 
    
         
             
                  # is this class nested within a namespace?
         
     | 
| 
       37 
37 
     | 
    
         
             
                  is_namespaced = module_names.any?
         
     | 
| 
       38 
38 
     | 
    
         
             
                  if is_namespaced
         
     | 
| 
      
 39 
     | 
    
         
            +
                    first_name = module_names.shift
         
     | 
| 
      
 40 
     | 
    
         
            +
                    # keep track of the namespace
         
     | 
| 
      
 41 
     | 
    
         
            +
                    namespace = "::#{first_name}"
         
     | 
| 
      
 42 
     | 
    
         
            +
                    # does this exist, and is it a class
         
     | 
| 
      
 43 
     | 
    
         
            +
                    is_class = Module.const_defined?(namespace) && Module.const_get(namespace).is_a?(Class)
         
     | 
| 
       39 
44 
     | 
    
         
             
                    # first module is always prepended by a "::" to ensure it is at the top most level
         
     | 
| 
       40 
     | 
    
         
            -
                    eval_code_lines << "module ::#{ 
     | 
| 
      
 45 
     | 
    
         
            +
                    eval_code_lines << "#{is_class ? "class" : "module"} ::#{first_name}"
         
     | 
| 
       41 
46 
     | 
    
         
             
                    # each remaining module name is just nested within this top most module
         
     | 
| 
       42 
47 
     | 
    
         
             
                    module_names.each do |module_name|
         
     | 
| 
       43 
     | 
    
         
            -
                       
     | 
| 
      
 48 
     | 
    
         
            +
                      # keep building the namespace we we go
         
     | 
| 
      
 49 
     | 
    
         
            +
                      namespace = "#{namespace}::#{module_name}"
         
     | 
| 
      
 50 
     | 
    
         
            +
                      # does this exist, and is it a class
         
     | 
| 
      
 51 
     | 
    
         
            +
                      is_class = is_class = Module.const_defined?(namespace) && Module.const_get(namespace).is_a?(Class)
         
     | 
| 
      
 52 
     | 
    
         
            +
                      # add the next line
         
     | 
| 
      
 53 
     | 
    
         
            +
                      eval_code_lines << "#{is_class ? "class" : "module"} #{module_name}"
         
     | 
| 
       44 
54 
     | 
    
         
             
                    end
         
     | 
| 
       45 
55 
     | 
    
         
             
                  end
         
     | 
| 
       46 
56 
     | 
    
         
             
                  # the class definition
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,11 +1,11 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: class_spec_helper
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.1.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Craig Ulliott
         
     | 
| 
       8 
     | 
    
         
            -
            autorequire:
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
11 
     | 
    
         
             
            date: 2023-07-17 00:00:00.000000000 Z
         
     | 
| 
         @@ -27,13 +27,13 @@ files: 
     | 
|
| 
       27 
27 
     | 
    
         
             
            - lib/class_spec_helper/destroy_classes.rb
         
     | 
| 
       28 
28 
     | 
    
         
             
            - lib/class_spec_helper/naming.rb
         
     | 
| 
       29 
29 
     | 
    
         
             
            - lib/class_spec_helper/version.rb
         
     | 
| 
       30 
     | 
    
         
            -
            homepage:
         
     | 
| 
      
 30 
     | 
    
         
            +
            homepage: 
         
     | 
| 
       31 
31 
     | 
    
         
             
            licenses:
         
     | 
| 
       32 
32 
     | 
    
         
             
            - MIT
         
     | 
| 
       33 
33 
     | 
    
         
             
            metadata:
         
     | 
| 
       34 
34 
     | 
    
         
             
              source_code_uri: https://github.com/craigulliott/class_spec_helper/
         
     | 
| 
       35 
35 
     | 
    
         
             
              changelog_uri: https://github.com/craigulliott/class_spec_helper/blob/main/CHANGELOG.md
         
     | 
| 
       36 
     | 
    
         
            -
            post_install_message:
         
     | 
| 
      
 36 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
       37 
37 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       38 
38 
     | 
    
         
             
            require_paths:
         
     | 
| 
       39 
39 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -48,8 +48,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       48 
48 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       49 
49 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       50 
50 
     | 
    
         
             
            requirements: []
         
     | 
| 
       51 
     | 
    
         
            -
            rubygems_version: 3.3 
     | 
| 
       52 
     | 
    
         
            -
            signing_key:
         
     | 
| 
      
 51 
     | 
    
         
            +
            rubygems_version: 3.2.3
         
     | 
| 
      
 52 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
       53 
53 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       54 
54 
     | 
    
         
             
            summary: Easily create and destroy named classes for use within your specs.
         
     | 
| 
       55 
55 
     | 
    
         
             
            test_files: []
         
     |