site_prism-all_there 2.0.2 → 3.0.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 459330ae52be38a3c956befae04407c7752e2de0572117e905b93f2006541f96
|
4
|
+
data.tar.gz: bc70cd8a9754101ed16089d404c1ab51b6880eaa83fc4d6f842fc36d1c4628b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6825eebebda6309ce4ae31783ebac11e49614763415c0816c7c8645739bbcd6260cd219e6292a980cb4b7f7984239abdc2f6368d892dba1ae1045a4a15ec7928
|
7
|
+
data.tar.gz: 90a30f1610bdf40dea8f3d6640ee3f6aa9d9353fc78a6db1a69834cae9f3181bf63ea09b7be09de8fdc0f271c7534d85ffbf598d6ae14df374abfd2b80dfe0f5
|
@@ -19,48 +19,30 @@ module SitePrism
|
|
19
19
|
# All defined/expected mapped items
|
20
20
|
def array
|
21
21
|
[
|
22
|
-
element,
|
23
|
-
elements,
|
22
|
+
mapped_checklist_of(:element),
|
23
|
+
mapped_checklist_of(:elements),
|
24
24
|
section,
|
25
25
|
sections,
|
26
|
-
iframe
|
26
|
+
mapped_checklist_of(:iframe)
|
27
27
|
]
|
28
28
|
end
|
29
29
|
|
30
|
-
# @return [Array<Symbol>]
|
31
|
-
# All defined/expected items that were mapped as +element+
|
32
|
-
def element
|
33
|
-
mapped_checklist_of(:element) || []
|
34
|
-
end
|
35
|
-
|
36
|
-
# @return [Array<Symbol>]
|
37
|
-
# All defined/expected items that were mapped as +elements+
|
38
|
-
def elements
|
39
|
-
mapped_checklist_of(:elements) || []
|
40
|
-
end
|
41
|
-
|
42
30
|
# @return [Array<Symbol>]
|
43
31
|
# All defined/expected items that were mapped as +section+
|
44
32
|
def section
|
45
|
-
mapped_checklist_of(:section)
|
33
|
+
mapped_checklist_of(:section)
|
46
34
|
end
|
47
35
|
|
48
36
|
# @return [Array<Symbol>]
|
49
37
|
# All defined/expected items that were mapped as +sections+
|
50
38
|
def sections
|
51
|
-
mapped_checklist_of(:sections)
|
52
|
-
end
|
53
|
-
|
54
|
-
# @return [Array<Symbol>]
|
55
|
-
# All defined/expected items that were mapped as +iframe+
|
56
|
-
def iframe
|
57
|
-
mapped_checklist_of(:iframe) || []
|
39
|
+
mapped_checklist_of(:sections)
|
58
40
|
end
|
59
41
|
|
60
42
|
private
|
61
43
|
|
62
44
|
def mapped_checklist_of(type)
|
63
|
-
mapped_items.hash[type]
|
45
|
+
mapped_items.hash[type] & mapped_checklist
|
64
46
|
end
|
65
47
|
|
66
48
|
def mapped_checklist
|
@@ -3,8 +3,9 @@
|
|
3
3
|
module SitePrism
|
4
4
|
module AllThere
|
5
5
|
#
|
6
|
-
#
|
6
|
+
# @api private
|
7
7
|
#
|
8
|
+
# This will recurse through all of the objects found on an individual Page/Section level
|
8
9
|
# It will perform the `#all_there?` check on each `@instance` item that it is initialized with
|
9
10
|
#
|
10
11
|
class RecursionChecker
|
@@ -15,40 +16,39 @@ module SitePrism
|
|
15
16
|
@instance = instance
|
16
17
|
end
|
17
18
|
|
18
|
-
# @return [Boolean]
|
19
|
-
# This
|
20
|
-
|
21
|
-
|
22
|
-
recursion = SitePrism.recursion_setting if SitePrism.recursion_setting
|
19
|
+
# @return [Boolean || Nil]
|
20
|
+
# This is only meant to be invoked from the main site_prism gem where it will use whatever inputs it is given
|
21
|
+
def all_there?(recursion: nil, options: {})
|
22
|
+
setting = recursion || SitePrism.recursion_setting
|
23
23
|
|
24
|
-
case
|
25
|
-
when :none
|
26
|
-
current_class_all_there?
|
24
|
+
case setting
|
25
|
+
when nil, :none
|
26
|
+
current_class_all_there?(**options)
|
27
27
|
when :one
|
28
|
-
current_class_all_there? && section_classes_all_there? && sections_classes_all_there?
|
28
|
+
current_class_all_there?(**options) && section_classes_all_there?(**options) && sections_classes_all_there?(**options)
|
29
29
|
else
|
30
|
-
SitePrism.logger.debug("
|
30
|
+
SitePrism.logger.debug("Invalid input value '#{recursion}'. Valid values are nil, :none or :one.")
|
31
31
|
SitePrism.logger.error('Invalid recursion setting, Will not run #all_there?.')
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
private
|
36
36
|
|
37
|
-
def current_class_all_there?
|
38
|
-
expected_items.array.flatten.all? { |name| there?(name) }.tap do |result|
|
37
|
+
def current_class_all_there?(**opts)
|
38
|
+
expected_items.array.flatten.all? { |name| there?(name, **opts) }.tap do |result|
|
39
39
|
SitePrism.logger.info("Result of current_class_all_there?: #{result}")
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
def section_classes_all_there?
|
44
|
-
section_classes_to_check.all?
|
43
|
+
def section_classes_all_there?(**opts)
|
44
|
+
section_classes_to_check.all? { |section| section.all_there?(**opts) }.tap do |result|
|
45
45
|
SitePrism.logger.debug("Result of section_classes_all_there?: #{result}")
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
def sections_classes_all_there?
|
50
|
-
sections_classes_to_check.flatten.all?
|
51
|
-
SitePrism.logger.debug("Result of
|
49
|
+
def sections_classes_all_there?(**opts)
|
50
|
+
sections_classes_to_check.flatten.all? { |section| section.all_there?(**opts) }.tap do |result|
|
51
|
+
SitePrism.logger.debug("Result of sections_classes_all_there?: #{result}")
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -64,8 +64,8 @@ module SitePrism
|
|
64
64
|
@expected_items ||= ExpectedItems.new(instance)
|
65
65
|
end
|
66
66
|
|
67
|
-
def there?(name)
|
68
|
-
instance.send("has_#{name}?")
|
67
|
+
def there?(name, **opts)
|
68
|
+
instance.send("has_#{name}?", **opts)
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: site_prism-all_there
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luke Hill
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -30,42 +30,42 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.56.1
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.56.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubocop-performance
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.19.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.19.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rubocop-rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 2.
|
61
|
+
version: 2.23.2
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 2.
|
68
|
+
version: 2.23.2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: site_prism
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -125,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
125
|
requirements:
|
126
126
|
- - ">="
|
127
127
|
- !ruby/object:Gem::Version
|
128
|
-
version: '2.
|
128
|
+
version: '2.7'
|
129
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
130
|
requirements:
|
131
131
|
- - ">="
|