site_prism 6.0 → 6.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 +4 -4
- data/lib/site_prism/addressable_url_matcher.rb +5 -1
- data/lib/site_prism/loadable.rb +13 -10
- data/lib/site_prism/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cbf69e354e41352b4e8b03aa44073b0b4f6b1d77edbfe8be80c670aac96f2b81
|
|
4
|
+
data.tar.gz: 680daa2c693b77fe00c0e7ce1b3eeda648a9c088cefa7b6fbf2bb6783d5b57a4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1b963f301fbc93813259dfa275e02b60ed9ca49aea6765f86b5117a06cd9063c6f7cd2380a1b80c3e975de5f22869d315e7ed6b0a3973aae91ec66bfaa74f48e
|
|
7
|
+
data.tar.gz: a7f9fda146472e1ae262ed5078108bb1080ac085115e703a310b2a259d448449a2cc567e8809836beb3501d25bcffbc4fd80e38275127e916610794a97516214
|
|
@@ -102,7 +102,11 @@ module SitePrism
|
|
|
102
102
|
end
|
|
103
103
|
|
|
104
104
|
def slugs
|
|
105
|
-
|
|
105
|
+
if RUBY_VERSION >= '3.2'
|
|
106
|
+
pattern.scan(Regexp.new('{[^}]+}', timeout: 5))
|
|
107
|
+
else
|
|
108
|
+
pattern.scan(/{[^}]+}/)
|
|
109
|
+
end
|
|
106
110
|
end
|
|
107
111
|
|
|
108
112
|
def all_expected_mappings_match?(expected_mappings, actual_mappings)
|
data/lib/site_prism/loadable.rb
CHANGED
|
@@ -23,11 +23,11 @@ module SitePrism
|
|
|
23
23
|
#
|
|
24
24
|
# NB: This will only trigger load validations if the page is already **not** loaded. If you want to verbosely trigger
|
|
25
25
|
# the load validations irrespective, use `#run_load_validations`; which will clear any previous cache and then re-run the validations
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
#
|
|
27
|
+
# @param previously_loaded [Boolean, nil]
|
|
28
|
+
# Original loaded value (which may be nil), in case we are nested inside another `#when_loaded` block or called
|
|
29
|
+
# prior to the `#run_load_validations` invocation
|
|
30
|
+
def when_loaded(previously_loaded = loaded)
|
|
31
31
|
# Within the block, check (and cache) loaded?, to see whether the page has indeed loaded according to the rules defined by the user.
|
|
32
32
|
self.loaded = loaded?
|
|
33
33
|
|
|
@@ -38,7 +38,8 @@ module SitePrism
|
|
|
38
38
|
# Return the yield value of the block if one was supplied.
|
|
39
39
|
yield self if block_given?
|
|
40
40
|
ensure
|
|
41
|
-
|
|
41
|
+
# Restore the previous loaded state only if validations passed (i.e., loaded? was true).
|
|
42
|
+
self.loaded = previously_loaded if loaded
|
|
42
43
|
end
|
|
43
44
|
|
|
44
45
|
# Check if the page is loaded.
|
|
@@ -56,16 +57,18 @@ module SitePrism
|
|
|
56
57
|
load_validations_pass?
|
|
57
58
|
end
|
|
58
59
|
|
|
59
|
-
# Executes the
|
|
60
|
-
#
|
|
60
|
+
# Executes the `#when_loaded` check to determine if the page is loaded, but also temporarily clears any previously cached
|
|
61
|
+
# loaded state / load error(s), to ensure load validations are re-ran fully
|
|
61
62
|
#
|
|
62
63
|
# This is useful if you want to re-run the load validations irrespective of whether the page was previously loaded or not
|
|
63
64
|
#
|
|
64
65
|
# The loadable object instance is yielded into the block.
|
|
65
|
-
def run_load_validations
|
|
66
|
+
def run_load_validations(&)
|
|
67
|
+
previously_loaded = loaded
|
|
68
|
+
|
|
66
69
|
self.loaded = false
|
|
67
70
|
self.load_error = nil
|
|
68
|
-
when_loaded
|
|
71
|
+
when_loaded(previously_loaded, &)
|
|
69
72
|
end
|
|
70
73
|
|
|
71
74
|
private
|
data/lib/site_prism/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: site_prism
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 6.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Luke Hill
|
|
@@ -151,14 +151,14 @@ dependencies:
|
|
|
151
151
|
requirements:
|
|
152
152
|
- - "~>"
|
|
153
153
|
- !ruby/object:Gem::Version
|
|
154
|
-
version: 1.
|
|
154
|
+
version: 1.88.0
|
|
155
155
|
type: :development
|
|
156
156
|
prerelease: false
|
|
157
157
|
version_requirements: !ruby/object:Gem::Requirement
|
|
158
158
|
requirements:
|
|
159
159
|
- - "~>"
|
|
160
160
|
- !ruby/object:Gem::Version
|
|
161
|
-
version: 1.
|
|
161
|
+
version: 1.88.0
|
|
162
162
|
- !ruby/object:Gem::Dependency
|
|
163
163
|
name: rubocop-performance
|
|
164
164
|
requirement: !ruby/object:Gem::Requirement
|