rspec-support 3.13.4 → 3.13.5
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
- checksums.yaml.gz.sig +0 -0
- data/Changelog.md +10 -1
- data/lib/rspec/support/method_signature_verifier.rb +35 -10
- data/lib/rspec/support/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +4 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 627c7e28fcb4a040f33ce0f321252d4c659389a6f1230df267c9f923be43c3d9
|
4
|
+
data.tar.gz: 6147b06d1eb09093a6c94ebb4b2779a24f40bf6d137e3800827671f2eac077ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c7110b65063601e4f8fc2cc6f49a43dcd363b5c2bcc94671b515362be6b780e3ab0e7e3c27ed3bd63333574bac38ff697e5d43cf771763c1712a90a4c099c93
|
7
|
+
data.tar.gz: 30b20b1b6134613b68a467f5af2c8edf2570e7f8fe7a6feeb74e751d4f7f577dc7e02243f43fab83c8dfeb0cd7a7809767a4d18394daf1979d4dd11814acffd5
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/Changelog.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
### Development
|
2
|
-
[Full Changelog](https://github.com/rspec/rspec/compare/rspec-support-v3.13.
|
2
|
+
[Full Changelog](https://github.com/rspec/rspec/compare/rspec-support-v3.13.5...3-13-maintenance)
|
3
|
+
|
4
|
+
### 3.13.5
|
5
|
+
[Full Changelog](http://github.com/rspec/rspec/compare/rspec-support-v3.13.4...rspec-support-v3.13.5)
|
6
|
+
|
7
|
+
Bug Fixes:
|
8
|
+
|
9
|
+
* Fix regression in `RSpec::Support::MethodSignature` where positional argument arity confused
|
10
|
+
a check for keyword arguments, meaning a hash would be wrongly detected as keyword arguments
|
11
|
+
when it should have been a positional argument. (Malcolm O'Hare, rspec/rspec#121)
|
3
12
|
|
4
13
|
### 3.13.4
|
5
14
|
[Full Changelog](http://github.com/rspec/rspec/compare/rspec-support-v3.13.3...rspec-support-v3.13.4)
|
@@ -79,12 +79,37 @@ module RSpec
|
|
79
79
|
given_kw_args - @allowed_kw_args
|
80
80
|
end
|
81
81
|
|
82
|
-
#
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
could_contain_kw_args?(args)
|
87
|
-
|
82
|
+
# Considering the arg types, are there kw_args?
|
83
|
+
if RubyFeatures.kw_arg_separation?
|
84
|
+
def has_kw_args_in?(args)
|
85
|
+
# If the last arg is a hash, depending on the signature it could be kw_args or a positional parameter.
|
86
|
+
return false unless Hash === args.last && could_contain_kw_args?(args)
|
87
|
+
|
88
|
+
# If the position of the hash is beyond the count of required and optional positional
|
89
|
+
# args then it is the kwargs hash
|
90
|
+
return true if args.count > @max_non_kw_args
|
91
|
+
|
92
|
+
# This is the proper way to disambiguate between positional args and keywords hash
|
93
|
+
# but relies on beginning of the call chain annotating the method with
|
94
|
+
# ruby2_keywords, so only use it for positive feedback as without the annotation
|
95
|
+
# this is always false
|
96
|
+
return true if Hash.ruby2_keywords_hash?(args[-1])
|
97
|
+
|
98
|
+
# Otherwise, the hash could be defined kw_args or an optional positional parameter
|
99
|
+
# inspect the keys against known kwargs to determine what it is
|
100
|
+
# Note: the problem with this is that if a user passes only invalid keyword args,
|
101
|
+
# rspec no longer detects is and will assign this to a positional argument
|
102
|
+
return arbitrary_kw_args? || args.last.keys.all? { |x| @allowed_kw_args.include?(x) }
|
103
|
+
end
|
104
|
+
else
|
105
|
+
def has_kw_args_in?(args)
|
106
|
+
# Version <= Ruby 2.7
|
107
|
+
# If the last argument is Hash, Ruby will treat only symbol keys as keyword arguments
|
108
|
+
# the rest will be grouped in another Hash and passed as positional argument.
|
109
|
+
Hash === args.last &&
|
110
|
+
could_contain_kw_args?(args) &&
|
111
|
+
(args.last.empty? || args.last.keys.any? { |x| x.is_a?(Symbol) })
|
112
|
+
end
|
88
113
|
end
|
89
114
|
|
90
115
|
# Without considering what the last arg is, could it
|
@@ -282,7 +307,7 @@ module RSpec
|
|
282
307
|
|
283
308
|
def initialize(signature, args=[])
|
284
309
|
@signature = signature
|
285
|
-
@non_kw_args, @kw_args = split_args(
|
310
|
+
@non_kw_args, @kw_args = split_args(args.clone)
|
286
311
|
@min_non_kw_args = @max_non_kw_args = @non_kw_args
|
287
312
|
@arbitrary_kw_args = @unlimited_args = false
|
288
313
|
end
|
@@ -362,7 +387,7 @@ module RSpec
|
|
362
387
|
!@unlimited_args || @signature.unlimited_args?
|
363
388
|
end
|
364
389
|
|
365
|
-
def split_args(
|
390
|
+
def split_args(args)
|
366
391
|
kw_args = if @signature.has_kw_args_in?(args) && !RubyFeatures.kw_arg_separation?
|
367
392
|
last = args.pop
|
368
393
|
non_kw_args = last.reject { |k, _| k.is_a?(Symbol) }
|
@@ -395,13 +420,13 @@ module RSpec
|
|
395
420
|
class LooseSignatureVerifier < MethodSignatureVerifier
|
396
421
|
private
|
397
422
|
|
398
|
-
def split_args(
|
423
|
+
def split_args(args)
|
399
424
|
if RSpec::Support.is_a_matcher?(args.last) && @signature.could_contain_kw_args?(args)
|
400
425
|
args.pop
|
401
426
|
@signature = SignatureWithKeywordArgumentsMatcher.new(@signature)
|
402
427
|
end
|
403
428
|
|
404
|
-
super(
|
429
|
+
super(args)
|
405
430
|
end
|
406
431
|
|
407
432
|
# If a matcher is used in a signature in place of keyword arguments, all
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.13.
|
4
|
+
version: 3.13.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Chelimsky
|
@@ -123,11 +123,11 @@ licenses:
|
|
123
123
|
- MIT
|
124
124
|
metadata:
|
125
125
|
bug_tracker_uri: https://github.com/rspec/rspec/issues
|
126
|
-
changelog_uri: https://github.com/rspec/rspec/blob/rspec-support-v3.13.
|
126
|
+
changelog_uri: https://github.com/rspec/rspec/blob/rspec-support-v3.13.5/rspec-support/Changelog.md
|
127
127
|
documentation_uri: https://rspec.info/documentation/
|
128
128
|
mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
|
129
129
|
rubygems_mfa_required: 'true'
|
130
|
-
source_code_uri: https://github.com/rspec/rspec/blob/rspec-support-v3.13.
|
130
|
+
source_code_uri: https://github.com/rspec/rspec/blob/rspec-support-v3.13.5/rspec-support
|
131
131
|
rdoc_options:
|
132
132
|
- "--charset=UTF-8"
|
133
133
|
require_paths:
|
@@ -145,5 +145,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
145
|
requirements: []
|
146
146
|
rubygems_version: 3.6.7
|
147
147
|
specification_version: 4
|
148
|
-
summary: rspec-support-3.13.
|
148
|
+
summary: rspec-support-3.13.5
|
149
149
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|