site_prism-all_there 0.3.1 → 0.3.2
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/README.md +3 -5
- data/lib/site_prism/all_there.rb +6 -3
- data/lib/site_prism/all_there/expected_items.rb +19 -10
- data/lib/site_prism/all_there/mapped_items.rb +6 -4
- data/lib/site_prism/all_there/recursion_checker.rb +7 -6
- data/lib/site_prism/all_there/version.rb +3 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b0f024978aaf7ce949a6d96866ed273c4709316f94888b3475a96653b7bbb24
|
4
|
+
data.tar.gz: 5ea2dc38f87a1eef69ebe2b8cb930e63f2014665f43fb2d35a1842e3266e42b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '05180b088c0322b945aed510279d50e4ca448be32586a956d24351663f2456c3914694d1163e4bd85894ea22072361b3e4194f3a198f395d92cdb9d7dc8beace'
|
7
|
+
data.tar.gz: 78f898bde22a8d88351b39197224d13de8f72d9b84626791e451d2dd4d6318907dc43dc78aa5965b9e3f0c10312f5b3a7fae8e39fda2d4b9efc9013c9317ea02
|
data/README.md
CHANGED
@@ -5,15 +5,14 @@ The breakout gem from SitePrism to perform recursion checks for `#all_there?`
|
|
5
5
|
This gem is a breakout of the current `SitePrism::Page#all_there?` and `SitePrism::Section#all_there?`
|
6
6
|
methods which already exist.
|
7
7
|
|
8
|
-
At the moment, the gem is
|
9
|
-
currently released as a `0.x` version meaning it is not fully API stable.
|
8
|
+
At the moment, the gem is currently released as a `0.x` version meaning it is **not** fully API stable.
|
10
9
|
|
11
10
|
## Usage
|
12
11
|
|
13
12
|
Add the following code to either `spec_helper.rb` or `env.rb`
|
14
13
|
|
15
14
|
```rb
|
16
|
-
require 'site_prism/all_there
|
15
|
+
require 'site_prism/all_there'
|
17
16
|
|
18
17
|
SitePrism.use_all_there_gem = true
|
19
18
|
|
@@ -24,8 +23,7 @@ SitePrism.configure do |config|
|
|
24
23
|
end
|
25
24
|
```
|
26
25
|
|
27
|
-
This gem is
|
28
|
-
structure going forwards, to conform to the pairing of both gems.
|
26
|
+
This gem is likely to change structure going forwards, to conform to the pairing of both gems, expected in 2020.
|
29
27
|
|
30
28
|
Happy Testing / Developing!
|
31
29
|
|
data/lib/site_prism/all_there.rb
CHANGED
@@ -4,11 +4,9 @@ require 'site_prism/all_there/expected_items'
|
|
4
4
|
require 'site_prism/all_there/mapped_items'
|
5
5
|
require 'site_prism/all_there/recursion_checker'
|
6
6
|
|
7
|
-
#
|
7
|
+
# {SitePrism} namespace - In different folder to avoid namespace clashes with core gem
|
8
8
|
module SitePrism
|
9
9
|
class << self
|
10
|
-
# Configuration setting to use on a global scale
|
11
|
-
# Note this global setting can be overridden at runtime for each individual call
|
12
10
|
attr_accessor :recursion_setting
|
13
11
|
|
14
12
|
def configure
|
@@ -16,3 +14,8 @@ module SitePrism
|
|
16
14
|
end
|
17
15
|
end
|
18
16
|
end
|
17
|
+
|
18
|
+
module SitePrism
|
19
|
+
# {SitePrism::AllThere} namespace
|
20
|
+
module AllThere; end
|
21
|
+
end
|
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
module SitePrism
|
4
4
|
module AllThere
|
5
|
-
# Returns the Expected Item Map on a specific SitePrism object
|
6
5
|
#
|
7
|
-
# api private
|
6
|
+
# @api private
|
8
7
|
#
|
8
|
+
# The Expected Item Map on a SitePrism Page or Section
|
9
9
|
class ExpectedItems
|
10
10
|
attr_reader :instance
|
11
11
|
private :instance
|
@@ -14,32 +14,44 @@ module SitePrism
|
|
14
14
|
@instance = instance
|
15
15
|
end
|
16
16
|
|
17
|
+
# @return [Array<Hash<Symbol>>]
|
18
|
+
# All expected mapped items
|
17
19
|
def array
|
18
20
|
[
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
element,
|
22
|
+
elements,
|
23
|
+
section,
|
24
|
+
sections,
|
25
|
+
iframe,
|
24
26
|
]
|
25
27
|
end
|
26
28
|
|
29
|
+
# @return [Hash<Symbol>]
|
30
|
+
# All expected items that were mapped as +element+
|
27
31
|
def element
|
28
32
|
mapped_checklist_of(:element)
|
29
33
|
end
|
30
34
|
|
35
|
+
# @return [Hash<Symbol>]
|
36
|
+
# All expected items that were mapped as +elements+
|
31
37
|
def elements
|
32
38
|
mapped_checklist_of(:elements)
|
33
39
|
end
|
34
40
|
|
41
|
+
# @return [Hash<Symbol>]
|
42
|
+
# All expected items that were mapped as +section+
|
35
43
|
def section
|
36
44
|
mapped_checklist_of(:section)
|
37
45
|
end
|
38
46
|
|
47
|
+
# @return [Hash<Symbol>]
|
48
|
+
# All expected items that were mapped as +sections+
|
39
49
|
def sections
|
40
50
|
mapped_checklist_of(:sections)
|
41
51
|
end
|
42
52
|
|
53
|
+
# @return [Hash<Symbol>]
|
54
|
+
# All expected items that were mapped as +iframe+
|
43
55
|
def iframe
|
44
56
|
mapped_checklist_of(:iframe)
|
45
57
|
end
|
@@ -50,8 +62,6 @@ module SitePrism
|
|
50
62
|
mapped_items.hash[type].select { |name| mapped_checklist.include?(name) }
|
51
63
|
end
|
52
64
|
|
53
|
-
# If the page or section has expected_items set, return expected_items that are mapped
|
54
|
-
# otherwise just return the list of all mapped_items
|
55
65
|
def mapped_checklist
|
56
66
|
if checklist
|
57
67
|
SitePrism.logger.debug('Expected Items has been set.')
|
@@ -61,7 +71,6 @@ module SitePrism
|
|
61
71
|
end
|
62
72
|
end
|
63
73
|
|
64
|
-
# List of expected_items as defined during build phase
|
65
74
|
def checklist
|
66
75
|
instance.class.expected_items
|
67
76
|
end
|
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
module SitePrism
|
4
4
|
module AllThere
|
5
|
-
# Returns the Mapped Items on a specific SitePrism object
|
6
5
|
#
|
7
|
-
# api private
|
6
|
+
# @api private
|
8
7
|
#
|
8
|
+
# The Mapped Items on a SitePrism Page or Section
|
9
9
|
class MappedItems
|
10
10
|
attr_reader :instance
|
11
11
|
private :instance
|
@@ -14,12 +14,14 @@ module SitePrism
|
|
14
14
|
@instance = instance
|
15
15
|
end
|
16
16
|
|
17
|
-
#
|
17
|
+
# @return [Array<Symbol>]
|
18
|
+
# All expected mapped items on the SitePrism instance as a Symbol Array
|
18
19
|
def array
|
19
20
|
hash.values.flatten.uniq
|
20
21
|
end
|
21
22
|
|
22
|
-
#
|
23
|
+
# @return [Hash<Symbol>]
|
24
|
+
# All expected mapped items on the SitePrism instance as a Symbol Hash
|
23
25
|
def hash
|
24
26
|
instance.class.mapped_items(legacy: false)
|
25
27
|
end
|
@@ -12,6 +12,7 @@ module SitePrism
|
|
12
12
|
@instance = instance
|
13
13
|
end
|
14
14
|
|
15
|
+
# @return [Boolean]
|
15
16
|
# This is currently hard-coded to perform a recursion of depth +:one+
|
16
17
|
# It will be refactored to use either no input, +:none+, or +:one+ as the
|
17
18
|
# regular repo uses currently
|
@@ -27,20 +28,20 @@ module SitePrism
|
|
27
28
|
|
28
29
|
private
|
29
30
|
|
30
|
-
#
|
31
|
-
#
|
31
|
+
# @return [Boolean]
|
32
|
+
# Are all SitePrism objects that exist in +self+ present?
|
32
33
|
def current_class_all_there?
|
33
34
|
expected_items.array.flatten.all? { |name| there?(name) }
|
34
35
|
end
|
35
36
|
|
36
|
-
#
|
37
|
-
#
|
37
|
+
# @return [Boolean]
|
38
|
+
# Are all SitePrism objects that exist in all +self.section+ items present?
|
38
39
|
def section_classes_all_there?
|
39
40
|
section_classes_to_check.all?(&:all_there?)
|
40
41
|
end
|
41
42
|
|
42
|
-
#
|
43
|
-
#
|
43
|
+
# @return [Boolean]
|
44
|
+
# Are all SitePrism objects that exist in all +self.sections+ items present?
|
44
45
|
def sections_classes_all_there?
|
45
46
|
sections_classes_to_check.flatten.all?(&:all_there?)
|
46
47
|
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: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luke Hill
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '3.2'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: yard
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.9'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.9'
|
97
111
|
description: |-
|
98
112
|
SitePrism AllThere gives you a simple DSL in order to recursively query,
|
99
113
|
page/section/element structures on your page - exclusively for use with the SitePrism gem.
|