class_spec_helper 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +13 -2
- data/lib/class_spec_helper/create_classes.rb +10 -0
- data/lib/class_spec_helper/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e21827629a25a7fa533931a96a8e3317a0bf74dc5098481c51e7706be055761a
|
4
|
+
data.tar.gz: def51eadc569144a85d682661dbc743719bfcd9fa9b212cdf7d58d8b79c81168
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cdea831539568818a8f980c0308a9f9ae390b9378ac4533ba90462c62380ab2ec271dfced68a537b65a94c60a5bfa26dbb8b9a38e17dbe040d8a14313db29bd
|
7
|
+
data.tar.gz: c8f6b92393d49d9e2ac65c12019ff81272d69c9d6e462b2080852bc569beb389741dd6e59655bcf7fc5401df17d39b6ca52e927491eca0907e9bb70eb10d5f97
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [1.1.0](https://github.com/craigulliott/class_spec_helper/compare/v1.0.0...v1.1.0) (2023-07-17)
|
4
|
+
|
5
|
+
|
6
|
+
### Features
|
7
|
+
|
8
|
+
* manually running the garbage collector to allow for more reliable use of `ObjectSpace` ([87652cb](https://github.com/craigulliott/class_spec_helper/commit/87652cbd601348afbf21f4913483aa558f30d87e))
|
9
|
+
|
3
10
|
## 1.0.0 (2023-07-13)
|
4
11
|
|
5
12
|
|
data/README.md
CHANGED
@@ -51,11 +51,22 @@ require "class_spec_helper"
|
|
51
51
|
|
52
52
|
RSpec.configure do |config|
|
53
53
|
|
54
|
-
# make class_spec_helper conveniently
|
54
|
+
# make class_spec_helper conveniently accessible within your test suite
|
55
55
|
config.add_setting :class_spec_helper
|
56
56
|
config.class_spec_helper = ClassSpecHelper.new
|
57
57
|
|
58
|
-
#
|
58
|
+
# Run the garbage collector before each test. As long as there are no
|
59
|
+
# references in your code to the classes you created during your tests
|
60
|
+
# then this will help ensure that your classes are also completely destroyed.
|
61
|
+
#
|
62
|
+
# If you do not do this, then your deleted classes may still be available
|
63
|
+
# in `ObjectSpace` until the garbage collector runs. Adding this to your
|
64
|
+
# rspec is necessary if your code relies on `ObjectSpace`.
|
65
|
+
config.before(:each) do
|
66
|
+
ObjectSpace.garbage_collect
|
67
|
+
end
|
68
|
+
|
69
|
+
# destroy these dynamically created classes after each test
|
59
70
|
config.after(:each) do
|
60
71
|
config.class_spec_helper.remove_all_dynamically_created_classes
|
61
72
|
end
|
@@ -67,6 +67,16 @@ class ClassSpecHelper
|
|
67
67
|
|
68
68
|
# finish building the class
|
69
69
|
klass.class_eval(&block) if block
|
70
|
+
|
71
|
+
# If we are using this in a test suite and the same class names are being used
|
72
|
+
# between each test, then after creation has proven to be a good time to run the
|
73
|
+
# garbage collector manually. It is very likely that all references to the old
|
74
|
+
# class are gone at this point.
|
75
|
+
#
|
76
|
+
# We do this because it is possibe that this is being used within a test suite
|
77
|
+
# for an application which makes use of `ObjectSpace`, and deleted classes will
|
78
|
+
# still be available in `ObjectSpace` until the garbage collector runs.
|
79
|
+
ObjectSpace.garbage_collect
|
70
80
|
end
|
71
81
|
end
|
72
82
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: class_spec_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Craig Ulliott
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby gem to create named classes for use within your specs, and then
|
14
14
|
clear them out automatically between specs.
|
@@ -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.
|
52
|
-
signing_key:
|
51
|
+
rubygems_version: 3.3.26
|
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: []
|