site_prism-all_there 0.3.1 → 0.3.2

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: ccad9b48e94f6dd3edc3b05f3dc21ee1a6a2282ac59e1b68d05e8b1a5ac34361
4
- data.tar.gz: db69a5d921ef2821b52030eef022a769c922f86e0ed8fdae19ddf9fec11038dc
3
+ metadata.gz: 3b0f024978aaf7ce949a6d96866ed273c4709316f94888b3475a96653b7bbb24
4
+ data.tar.gz: 5ea2dc38f87a1eef69ebe2b8cb930e63f2014665f43fb2d35a1842e3266e42b5
5
5
  SHA512:
6
- metadata.gz: 02b9419d51dfc2fbe5c2c45366b7dd13bb55a0b2d87c2af861a9f360083fc905b13215299375eca117b325694d817acbb04a170eb196103d93b8a09ab4099fe0
7
- data.tar.gz: 0f082e123a6dd8f09df31f50c288a98febb4e207027940cfb761b86d18a3d46929c92ac6e6b59083376aed57ff7885e9e4dc9b0ce137233b92ee634c95e4ae61
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 very much considered a Work in Progress and works "as is". It 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 currently in the `0.x` phase, meaning it is API unstable and likely to change
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
 
@@ -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
- # Configure the behaviour of the site_prism-all_there gem
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
- mapped_checklist_of(:element),
20
- mapped_checklist_of(:elements),
21
- mapped_checklist_of(:section),
22
- mapped_checklist_of(:sections),
23
- mapped_checklist_of(:iframe),
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
- # All Mapped items on the SitePrism instance as a Symbol Array
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
- # All Mapped items on the SitePrism instance as a Symbol Hash
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
- # This will check all elements that are in the current scope
31
- # This is equivalent to checking with a recursion value of +:none+
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
- # This will check all elements that are in any of the individual
37
- # +section+ items defined in the current scope
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
- # This will check all elements that are in any instance of any of the
43
- # +sections+ items defined in the current scope
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
@@ -2,6 +2,8 @@
2
2
 
3
3
  module SitePrism
4
4
  module AllThere
5
- VERSION = '0.3.1'
5
+ # @return [String]
6
+ # Version of the gem
7
+ VERSION = '0.3.2'
6
8
  end
7
9
  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.1
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-10 00:00:00.000000000 Z
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.