site_prism 4.0.1 → 4.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/site_prism/rspec_matchers.rb +17 -4
- data/lib/site_prism/version.rb +1 -1
- data/lib/site_prism.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6702577fd95053cdaaa208fd2ee9434e3b6634cf7f20da087fa6d7d858c952cc
|
4
|
+
data.tar.gz: 8832e3b57c435d0e715e92c8c179781dc865ec98942518cb3cd982ecd845ca22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2607bc319b31ad2621e4b65d97680d24762d134f0ce0afa7a193e7e0d7021dfdc675f903d7b5b18f389f85dc30537d178a45dccdab3611b79c04c946dc9bca8
|
7
|
+
data.tar.gz: 5c2e419d8b490bb10a1afb0bb0673f8dbe4124786fcd7bc17d5ff8d6c90001da8e163a27ca6212158cb28d042043d0b5af1ad9750144c8891bdb89fe41f46bdf
|
@@ -22,17 +22,30 @@ module SitePrism
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def create_rspec_existence_matchers(matcher, object_method, negated_object_method, warning)
|
25
|
-
|
26
|
-
|
25
|
+
forward = forwarder(object_method)
|
26
|
+
|
27
|
+
RSpec::Matchers.define(matcher) do |*args, **options|
|
28
|
+
match { |actual| forward.call(actual, args, options) }
|
27
29
|
match_when_negated do |actual|
|
28
|
-
return
|
30
|
+
return forward.call(actual, args, options, negated_object_method) if actual.respond_to?(negated_object_method)
|
29
31
|
|
30
32
|
SitePrism.logger.debug(warning)
|
31
|
-
!
|
33
|
+
!forward.call(actual, args, options)
|
32
34
|
end
|
33
35
|
end
|
34
36
|
end
|
35
37
|
|
38
|
+
def forwarder(object_method)
|
39
|
+
lambda do |actual, args, options, method_name = object_method|
|
40
|
+
# To support Ruby 2.6. Otherwise methods that expect no arguments would fail with
|
41
|
+
# "wrong number of arguments (given 1, expected 0)" because Ruby 2.6 considers `method(**{})` the
|
42
|
+
# same as `method({})` (passing the empty Hash as an argument)
|
43
|
+
next actual.public_send(method_name, *args) if options.empty?
|
44
|
+
|
45
|
+
actual.public_send(method_name, *args, **options)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
36
49
|
def matcher
|
37
50
|
"have_#{element_name}"
|
38
51
|
end
|
data/lib/site_prism/version.rb
CHANGED
data/lib/site_prism.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.0.
|
4
|
+
version: 4.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luke Hill
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-05-
|
12
|
+
date: 2023-05-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: addressable
|