class_spec_helper 1.1.0 → 1.1.1

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: e21827629a25a7fa533931a96a8e3317a0bf74dc5098481c51e7706be055761a
4
- data.tar.gz: def51eadc569144a85d682661dbc743719bfcd9fa9b212cdf7d58d8b79c81168
3
+ metadata.gz: 77fafc1edfe0284bb0071806d91869a50796b28873c6477efaa8479517f85e51
4
+ data.tar.gz: 150badef8cbdd0a239c4d8dd35ccf0c38412111ad1233a75fb6c4a7029280ee4
5
5
  SHA512:
6
- metadata.gz: 6cdea831539568818a8f980c0308a9f9ae390b9378ac4533ba90462c62380ab2ec271dfced68a537b65a94c60a5bfa26dbb8b9a38e17dbe040d8a14313db29bd
7
- data.tar.gz: c8f6b92393d49d9e2ac65c12019ff81272d69c9d6e462b2080852bc569beb389741dd6e59655bcf7fc5401df17d39b6ca52e927491eca0907e9bb70eb10d5f97
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 ::#{module_names.shift}"
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
- eval_code_lines << "module #{module_name}"
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ClassSpecHelper
4
- VERSION = "1.1.0"
4
+ VERSION = "1.1.1"
5
5
  end
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.0
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.26
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: []