site_prism-all_there 1.0.1 → 2.0
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/LICENSE.md +1 -1
- data/README.md +53 -6
- data/lib/site_prism/all_there/expected_items.rb +7 -6
- data/lib/site_prism/all_there/mapped_items.rb +1 -0
- data/lib/site_prism/all_there/recursion_checker.rb +15 -14
- data/lib/site_prism/all_there/version.rb +1 -1
- metadata +20 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 376c04f51a8a815bae55f513721968bf3069c6fdc0f7f4685eaed8f05240f131
|
4
|
+
data.tar.gz: 3d181c424334f8c7be4749bc7f381508b4a9ea8f27aaa8ce74fcb817b7d6cad4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c12c252c431577beb45a46a895a891e486f583293f860711c3ad5fc405b05a24db55e498e1892c294a37eab9c580806a9c6660eb6438092985a7291534e495c5
|
7
|
+
data.tar.gz: 6024f46050a28a69fbffcfa40d763899abe0c3a7d10cbb9e32405eef14b0acfc2a6643c86560e416f6162a56e623cb5f6776337ccf6814cd0a40997cfaff4c4d
|
data/LICENSE.md
CHANGED
data/README.md
CHANGED
@@ -1,16 +1,24 @@
|
|
1
1
|
# site_prism-all_there
|
2
|
+
- [History](#history)
|
3
|
+
- [Enabling gem methods](#enabling-gem-methods)
|
4
|
+
- [Usage](#usage)
|
5
|
+
- [In-line configuration](#in-line-configuration)
|
6
|
+
- [Global configuration](#global-configuration)
|
7
|
+
- [Troubleshooting](#troubleshooting)
|
2
8
|
|
3
|
-
|
9
|
+
## History
|
10
|
+
|
11
|
+
This in the breakout gem from SitePrism to perform recursion checks for `#all_there?`
|
4
12
|
|
5
13
|
This gem is a breakout of the current `SitePrism::Page#all_there?` and `SitePrism::Section#all_there?`
|
6
|
-
methods which already
|
14
|
+
methods which have already existed in the gem since version 2.
|
7
15
|
|
8
|
-
The gem is
|
9
|
-
functionality in `site_prism` version 4. Which is slated for release early
|
16
|
+
The gem is **now finally** version stable. It will be added as default
|
17
|
+
functionality in `site_prism` version 4. Which is slated for release early 2023!
|
10
18
|
|
11
|
-
##
|
19
|
+
## Enabling gem methods
|
12
20
|
|
13
|
-
Add the following code to either `spec_helper.rb` or `env.rb`
|
21
|
+
- Add the following code to either `spec_helper.rb` or `env.rb` (Pre version 4)
|
14
22
|
|
15
23
|
```rb
|
16
24
|
require 'site_prism/all_there'
|
@@ -19,11 +27,50 @@ SitePrism.use_all_there_gem = true
|
|
19
27
|
|
20
28
|
# or...
|
21
29
|
|
30
|
+
require 'site_prism/all_there'
|
31
|
+
|
22
32
|
SitePrism.configure do |config|
|
23
33
|
config.use_all_there_gem = true
|
24
34
|
end
|
25
35
|
```
|
26
36
|
|
37
|
+
> From version 4 onwards this is done by default and isn't required
|
38
|
+
|
39
|
+
## Usage
|
40
|
+
|
41
|
+
### In-line configuration
|
42
|
+
|
43
|
+
```rb
|
44
|
+
your_page = YourPage.new
|
45
|
+
|
46
|
+
your_page.all_there?(recursion: :none) # This will do the standard `#all_there?` check on the current page
|
47
|
+
your_page.all_there?(recursion: :one) # This will do the standard `#all_there?` check on the current page as well recursing into all `:section` or `:sections` objects and then doing the standard `#all_there?` check on those `Section` instances
|
48
|
+
your_page.all_there?(recursion: :invalid) # This will not perform any checks and just throw an error message
|
49
|
+
```
|
50
|
+
|
51
|
+
### Global configuration
|
52
|
+
|
53
|
+
```rb
|
54
|
+
SitePrism.recursion_setting = :one
|
55
|
+
your_page = YourPage.new
|
56
|
+
your_page.all_there?(recursion: :ignore) # This will do the standard `#all_there?` check on the current page as well recursing into all `:section` or `:sections` objects and then doing the standard `#all_there?` check on those sections
|
57
|
+
|
58
|
+
# or...
|
59
|
+
|
60
|
+
SitePrism.configure do |config|
|
61
|
+
config.recursion_setting = :one
|
62
|
+
end
|
63
|
+
|
64
|
+
your_page = YourPage.new
|
65
|
+
your_page.all_there?(recursion: :ignore) # This will do the standard `#all_there?` check on the current page as well recursing into all `:section` or `:sections` objects and then doing the standard `#all_there?` check on those `Section` instances
|
66
|
+
```
|
67
|
+
|
68
|
+
Then you can perform the above checks using the global config.
|
69
|
+
|
70
|
+
## Troubleshooting
|
71
|
+
|
72
|
+
Mixing and matching the global config won't work - To come in v3!
|
73
|
+
|
27
74
|
Happy Testing / Developing!
|
28
75
|
|
29
76
|
The SitePrism team
|
@@ -6,6 +6,7 @@ module SitePrism
|
|
6
6
|
# @api private
|
7
7
|
#
|
8
8
|
# The Expected Items to be present on a SitePrism Page or Section
|
9
|
+
#
|
9
10
|
class ExpectedItems
|
10
11
|
attr_reader :instance
|
11
12
|
private :instance
|
@@ -15,7 +16,7 @@ module SitePrism
|
|
15
16
|
end
|
16
17
|
|
17
18
|
# @return [Array<Array<Symbol>>]
|
18
|
-
# All expected mapped items
|
19
|
+
# All defined/expected mapped items
|
19
20
|
def array
|
20
21
|
[
|
21
22
|
element,
|
@@ -27,31 +28,31 @@ module SitePrism
|
|
27
28
|
end
|
28
29
|
|
29
30
|
# @return [Array<Symbol>]
|
30
|
-
# All expected items that were mapped as +element+
|
31
|
+
# All defined/expected items that were mapped as +element+
|
31
32
|
def element
|
32
33
|
mapped_checklist_of(:element) || []
|
33
34
|
end
|
34
35
|
|
35
36
|
# @return [Array<Symbol>]
|
36
|
-
# All expected items that were mapped as +elements+
|
37
|
+
# All defined/expected items that were mapped as +elements+
|
37
38
|
def elements
|
38
39
|
mapped_checklist_of(:elements) || []
|
39
40
|
end
|
40
41
|
|
41
42
|
# @return [Array<Symbol>]
|
42
|
-
# All expected items that were mapped as +section+
|
43
|
+
# All defined/expected items that were mapped as +section+
|
43
44
|
def section
|
44
45
|
mapped_checklist_of(:section) || []
|
45
46
|
end
|
46
47
|
|
47
48
|
# @return [Array<Symbol>]
|
48
|
-
# All expected items that were mapped as +sections+
|
49
|
+
# All defined/expected items that were mapped as +sections+
|
49
50
|
def sections
|
50
51
|
mapped_checklist_of(:sections) || []
|
51
52
|
end
|
52
53
|
|
53
54
|
# @return [Array<Symbol>]
|
54
|
-
# All expected items that were mapped as +iframe+
|
55
|
+
# All defined/expected items that were mapped as +iframe+
|
55
56
|
def iframe
|
56
57
|
mapped_checklist_of(:iframe) || []
|
57
58
|
end
|
@@ -2,8 +2,11 @@
|
|
2
2
|
|
3
3
|
module SitePrism
|
4
4
|
module AllThere
|
5
|
-
#
|
6
|
-
#
|
5
|
+
#
|
6
|
+
# This will recurse through all of the objects found on an individual Page/Section level
|
7
|
+
#
|
8
|
+
# It will perform the `#all_there?` check on each `@instance` item that it is initialized with
|
9
|
+
#
|
7
10
|
class RecursionChecker
|
8
11
|
attr_reader :instance
|
9
12
|
private :instance
|
@@ -16,36 +19,34 @@ module SitePrism
|
|
16
19
|
# This currently defaults to perform a recursion of depth +:one+
|
17
20
|
# It will be refactored to use either no input, +:none+, or +:one+ as the
|
18
21
|
# regular repo uses currently
|
19
|
-
def all_there?(recursion:
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
else
|
22
|
+
def all_there?(recursion:)
|
23
|
+
recursion = SitePrism.recursion_setting if SitePrism.recursion_setting
|
24
|
+
|
25
|
+
case recursion
|
26
|
+
when :none
|
25
27
|
current_class_all_there?
|
28
|
+
when :one
|
29
|
+
current_class_all_there? && section_classes_all_there? && sections_classes_all_there?
|
30
|
+
else
|
31
|
+
SitePrism.logger.debug("Input value '#{recursion}'. Valid values are :none or :one.")
|
32
|
+
SitePrism.logger.error('Invalid recursion setting, Will not run #all_there?.')
|
26
33
|
end
|
27
34
|
end
|
28
35
|
|
29
36
|
private
|
30
37
|
|
31
|
-
# @return [Boolean]
|
32
|
-
# Are all SitePrism objects that exist in +self+ present?
|
33
38
|
def current_class_all_there?
|
34
39
|
expected_items.array.flatten.all? { |name| there?(name) }.tap do |result|
|
35
40
|
SitePrism.logger.info("Result of current_class_all_there?: #{result}")
|
36
41
|
end
|
37
42
|
end
|
38
43
|
|
39
|
-
# @return [Boolean]
|
40
|
-
# Are all SitePrism objects that exist in all +self.section+ items present?
|
41
44
|
def section_classes_all_there?
|
42
45
|
section_classes_to_check.all?(&:all_there?).tap do |result|
|
43
46
|
SitePrism.logger.debug("Result of section_classes_all_there?: #{result}")
|
44
47
|
end
|
45
48
|
end
|
46
49
|
|
47
|
-
# @return [Boolean]
|
48
|
-
# Are all SitePrism objects that exist in all +self.sections+ items present?
|
49
50
|
def sections_classes_all_there?
|
50
51
|
sections_classes_to_check.flatten.all?(&:all_there?).tap do |result|
|
51
52
|
SitePrism.logger.debug("Result of section_classes_all_there?: #{result}")
|
metadata
CHANGED
@@ -1,113 +1,91 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: site_prism-all_there
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: '2.0'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luke Hill
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rake
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '13.0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '13.0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: rspec
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
17
|
- - "~>"
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version: '3.
|
19
|
+
version: '3.12'
|
34
20
|
type: :development
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
38
24
|
- - "~>"
|
39
25
|
- !ruby/object:Gem::Version
|
40
|
-
version: '3.
|
26
|
+
version: '3.12'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: rubocop
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
31
|
- - "~>"
|
46
32
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
33
|
+
version: 1.47.0
|
48
34
|
type: :development
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
38
|
- - "~>"
|
53
39
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
40
|
+
version: 1.47.0
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: rubocop-performance
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
45
|
- - "~>"
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 1.11.5
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rubocop-rake
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 0.6.0
|
47
|
+
version: 1.16.0
|
76
48
|
type: :development
|
77
49
|
prerelease: false
|
78
50
|
version_requirements: !ruby/object:Gem::Requirement
|
79
51
|
requirements:
|
80
52
|
- - "~>"
|
81
53
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
54
|
+
version: 1.16.0
|
83
55
|
- !ruby/object:Gem::Dependency
|
84
56
|
name: rubocop-rspec
|
85
57
|
requirement: !ruby/object:Gem::Requirement
|
86
58
|
requirements:
|
87
59
|
- - "~>"
|
88
60
|
- !ruby/object:Gem::Version
|
89
|
-
version: 2.
|
61
|
+
version: 2.17.1
|
90
62
|
type: :development
|
91
63
|
prerelease: false
|
92
64
|
version_requirements: !ruby/object:Gem::Requirement
|
93
65
|
requirements:
|
94
66
|
- - "~>"
|
95
67
|
- !ruby/object:Gem::Version
|
96
|
-
version: 2.
|
68
|
+
version: 2.17.1
|
97
69
|
- !ruby/object:Gem::Dependency
|
98
70
|
name: site_prism
|
99
71
|
requirement: !ruby/object:Gem::Requirement
|
100
72
|
requirements:
|
101
|
-
- - "
|
73
|
+
- - ">"
|
102
74
|
- !ruby/object:Gem::Version
|
103
75
|
version: '3.7'
|
76
|
+
- - "<"
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '5'
|
104
79
|
type: :development
|
105
80
|
prerelease: false
|
106
81
|
version_requirements: !ruby/object:Gem::Requirement
|
107
82
|
requirements:
|
108
|
-
- - "
|
83
|
+
- - ">"
|
109
84
|
- !ruby/object:Gem::Version
|
110
85
|
version: '3.7'
|
86
|
+
- - "<"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '5'
|
111
89
|
- !ruby/object:Gem::Dependency
|
112
90
|
name: yard
|
113
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -153,14 +131,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
153
131
|
requirements:
|
154
132
|
- - ">="
|
155
133
|
- !ruby/object:Gem::Version
|
156
|
-
version: '2.
|
134
|
+
version: '2.6'
|
157
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
136
|
requirements:
|
159
137
|
- - ">="
|
160
138
|
- !ruby/object:Gem::Version
|
161
139
|
version: '0'
|
162
140
|
requirements: []
|
163
|
-
rubygems_version: 3.
|
141
|
+
rubygems_version: 3.4.1
|
164
142
|
signing_key:
|
165
143
|
specification_version: 4
|
166
144
|
summary: An extension to allow you to recurse through your SitePrism Pages/Sections
|