rspec-support 3.9.1 → 3.9.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
- checksums.yaml.gz.sig +3 -3
- data.tar.gz.sig +0 -0
- data/Changelog.md +10 -0
- data/lib/rspec/support/encoded_string.rb +19 -52
- data/lib/rspec/support/version.rb +1 -1
- 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: '0608e9d9e32db7972f9ed9edf1acc660be6e859589a5bb40118979f32e3e3093'
|
4
|
+
data.tar.gz: df94499781e6a3f6460990392a90bcea42c4c1aaa028357139787ab1b92716df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7598c046151adc5322cddd117f5809c3b3f9b1271c5db74496d6961e0799c1fbf3a47d2b48f1195be96b3c2ce0baab7c11d2f19709d478fc44848523034b9514
|
7
|
+
data.tar.gz: f548fa1b506985c64d9d612463cb4ffb8b41233a86af16ee26449e936570dbe0d4c2f2d9ad5c7fe3cd1a1b57d3156fba368b2f44627634053c2f1db51f64fc6d
|
checksums.yaml.gz.sig
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
�
|
2
|
-
|
3
|
-
|
1
|
+
�i|?��R�.�����m!�~��L�29�[�&�x=
|
2
|
+
��f��l��䦆��; ��O��t[�j���wr�bE�&W�[�p
|
3
|
+
^S�:�$zXPL�o��
|
data.tar.gz.sig
CHANGED
Binary file
|
data/Changelog.md
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
+
### 3.9.2 / 2019-12-30
|
2
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.9.1...v3.9.2)
|
3
|
+
|
4
|
+
Bug Fixes:
|
5
|
+
|
6
|
+
* Remove unneeded eval. (Matijs van Zuijlen, #394)
|
7
|
+
|
1
8
|
### 3.9.1 / 2019-12-28
|
9
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.9.0...v3.9.1)
|
2
10
|
|
3
11
|
Bug Fixes:
|
4
12
|
|
@@ -6,12 +14,14 @@ Bug Fixes:
|
|
6
14
|
(Jon Rowe, #392)
|
7
15
|
|
8
16
|
### 3.9.0 / 2019-10-07
|
17
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.8.3...v3.9.0)
|
9
18
|
|
10
19
|
*NO CHANGES*
|
11
20
|
|
12
21
|
Version 3.9.0 was released to allow other RSpec gems to release 3.9.0.
|
13
22
|
|
14
23
|
### 3.8.3 / 2019-10-02
|
24
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.8.2...v3.8.3)
|
15
25
|
|
16
26
|
Bug Fixes:
|
17
27
|
|
@@ -5,31 +5,11 @@ module RSpec
|
|
5
5
|
# Reduce allocations by storing constants.
|
6
6
|
UTF_8 = "UTF-8"
|
7
7
|
US_ASCII = "US-ASCII"
|
8
|
-
|
9
|
-
# In MRI 2.1 'invalid: :replace' changed to also replace an invalid byte sequence
|
10
|
-
# see https://github.com/ruby/ruby/blob/v2_1_0/NEWS#L176
|
11
|
-
# https://www.ruby-forum.com/topic/6861247
|
12
|
-
# https://twitter.com/nalsh/status/553413844685438976
|
13
|
-
#
|
14
|
-
# For example, given:
|
15
|
-
# "\x80".force_encoding("Emacs-Mule").encode(:invalid => :replace).bytes.to_a
|
16
|
-
#
|
17
|
-
# On MRI 2.1 or above: 63 # '?'
|
18
|
-
# else : 128 # "\x80"
|
19
|
-
#
|
8
|
+
|
20
9
|
# Ruby's default replacement string is:
|
21
10
|
# U+FFFD ("\xEF\xBF\xBD"), for Unicode encoding forms, else
|
22
11
|
# ? ("\x3F")
|
23
12
|
REPLACE = "?"
|
24
|
-
ENCODE_UNCONVERTABLE_BYTES = {
|
25
|
-
:invalid => :replace,
|
26
|
-
:undef => :replace,
|
27
|
-
:replace => REPLACE
|
28
|
-
}
|
29
|
-
ENCODE_NO_CONVERTER = {
|
30
|
-
:invalid => :replace,
|
31
|
-
:replace => REPLACE
|
32
|
-
}
|
33
13
|
|
34
14
|
def initialize(string, encoding=nil)
|
35
15
|
@encoding = encoding
|
@@ -112,40 +92,27 @@ module RSpec
|
|
112
92
|
string = remove_invalid_bytes(string)
|
113
93
|
string.encode(@encoding)
|
114
94
|
rescue Encoding::UndefinedConversionError, Encoding::InvalidByteSequenceError
|
115
|
-
|
95
|
+
# Originally defined as a constant to avoid uneeded allocations, this hash must
|
96
|
+
# be defined inline (without {}) to avoid warnings on Ruby 2.7
|
97
|
+
#
|
98
|
+
# In MRI 2.1 'invalid: :replace' changed to also replace an invalid byte sequence
|
99
|
+
# see https://github.com/ruby/ruby/blob/v2_1_0/NEWS#L176
|
100
|
+
# https://www.ruby-forum.com/topic/6861247
|
101
|
+
# https://twitter.com/nalsh/status/553413844685438976
|
102
|
+
#
|
103
|
+
# For example, given:
|
104
|
+
# "\x80".force_encoding("Emacs-Mule").encode(:invalid => :replace).bytes.to_a
|
105
|
+
#
|
106
|
+
# On MRI 2.1 or above: 63 # '?'
|
107
|
+
# else : 128 # "\x80"
|
108
|
+
#
|
109
|
+
string.encode(@encoding, :invalid => :replace, :undef => :replace, :replace => REPLACE)
|
116
110
|
rescue Encoding::ConverterNotFoundError
|
117
|
-
|
111
|
+
# Originally defined as a constant to avoid uneeded allocations, this hash must
|
112
|
+
# be defined inline (without {}) to avoid warnings on Ruby 2.7
|
113
|
+
string.dup.force_encoding(@encoding).encode(:invalid => :replace, :replace => REPLACE)
|
118
114
|
end
|
119
115
|
|
120
|
-
private
|
121
|
-
|
122
|
-
# On Ruby 2.7.0 keyword arguments mixed with conventional cause a warning to
|
123
|
-
# be issued requiring us to be explicit by using a ** to pass the hash as
|
124
|
-
# keyword arguments. Any keyword argument supporting Ruby supports this.
|
125
|
-
if RubyFeatures.kw_args_supported?
|
126
|
-
# Note on non keyword supporting Ruby ** causes a syntax error hence
|
127
|
-
# we must use eval. To be removed in RSpec 4.
|
128
|
-
binding.eval(<<-CODE, __FILE__, __LINE__)
|
129
|
-
def encode_unconvertable_bytes(string)
|
130
|
-
string.encode(@encoding, **ENCODE_UNCONVERTABLE_BYTES)
|
131
|
-
end
|
132
|
-
|
133
|
-
def encode_no_converter(string)
|
134
|
-
string.encode(**ENCODE_NO_CONVERTER)
|
135
|
-
end
|
136
|
-
CODE
|
137
|
-
else
|
138
|
-
def encode_unconvertable_bytes(string)
|
139
|
-
string.encode(@encoding, ENCODE_UNCONVERTABLE_BYTES)
|
140
|
-
end
|
141
|
-
|
142
|
-
def encode_no_converter(string)
|
143
|
-
string.encode(ENCODE_NO_CONVERTER)
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
public
|
148
|
-
|
149
116
|
# Prevents raising ArgumentError
|
150
117
|
if String.method_defined?(:scrub)
|
151
118
|
# https://github.com/ruby/ruby/blob/eeb05e8c11/doc/NEWS-2.1.0#L120-L123
|
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.9.
|
4
|
+
version: 3.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Chelimsky
|
@@ -48,7 +48,7 @@ cert_chain:
|
|
48
48
|
ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
|
49
49
|
F3MdtaDehhjC
|
50
50
|
-----END CERTIFICATE-----
|
51
|
-
date: 2019-12-
|
51
|
+
date: 2019-12-30 00:00:00.000000000 Z
|
52
52
|
dependencies:
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: rake
|
@@ -123,7 +123,7 @@ licenses:
|
|
123
123
|
- MIT
|
124
124
|
metadata:
|
125
125
|
bug_tracker_uri: https://github.com/rspec/rspec-support/issues
|
126
|
-
changelog_uri: https://github.com/rspec/rspec-support/blob/v3.9.
|
126
|
+
changelog_uri: https://github.com/rspec/rspec-support/blob/v3.9.2/Changelog.md
|
127
127
|
documentation_uri: https://rspec.info/documentation/
|
128
128
|
mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
|
129
129
|
source_code_uri: https://github.com/rspec/rspec-support
|
@@ -146,5 +146,5 @@ requirements: []
|
|
146
146
|
rubygems_version: 3.1.2
|
147
147
|
signing_key:
|
148
148
|
specification_version: 4
|
149
|
-
summary: rspec-support-3.9.
|
149
|
+
summary: rspec-support-3.9.2
|
150
150
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|