rspec-support 3.9.1 → 3.10.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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Changelog.md +42 -0
- data/README.md +2 -2
- data/lib/rspec/support/caller_filter.rb +1 -1
- data/lib/rspec/support/comparable_version.rb +1 -1
- data/lib/rspec/support/encoded_string.rb +19 -52
- data/lib/rspec/support/method_signature_verifier.rb +2 -2
- data/lib/rspec/support/reentrant_mutex.rb +9 -1
- data/lib/rspec/support/ruby_features.rb +11 -5
- data/lib/rspec/support/source.rb +10 -0
- data/lib/rspec/support/spec.rb +4 -3
- data/lib/rspec/support/spec/deprecation_helpers.rb +13 -29
- data/lib/rspec/support/spec/diff_helpers.rb +31 -0
- data/lib/rspec/support/spec/in_sub_process.rb +1 -3
- data/lib/rspec/support/spec/shell_out.rb +24 -8
- data/lib/rspec/support/spec/stderr_splitter.rb +8 -0
- data/lib/rspec/support/spec/string_matcher.rb +0 -1
- data/lib/rspec/support/version.rb +1 -1
- data/lib/rspec/support/with_keywords_when_needed.rb +33 -0
- metadata +12 -10
- 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: 0be846a7cb6f9beea5cfef26b956941bb7f8d484eb3e64108b5048cfa59faca9
|
4
|
+
data.tar.gz: 97080c0ee2193acce8355f57c01da00c61cd8bd0b71e09339362fbf95d6f2409
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e1527304c7ce880144c856172bb15096fdf927e068bbded2891b159232e0f0270d72bc7c3c08bddc7dc816bf2f9160198d7c76c1ea7d4a685ad40434932a202
|
7
|
+
data.tar.gz: 3d1919d9e66ce31692ce339d506a500972f42e6f1c2e01c48f0353902d44d0655dea3546067908ae3e47f875cd214b3460d73a477ff12fba2bde658104890706
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/Changelog.md
CHANGED
@@ -1,4 +1,44 @@
|
|
1
|
+
### 3.10.1 / 2020-12-27
|
2
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.10.0...v3.10.1)
|
3
|
+
|
4
|
+
Bug Fixes:
|
5
|
+
|
6
|
+
* Fix deprecation expectations to fail correctly when
|
7
|
+
asserting on messages. (Phil Pirozhkov, #453)
|
8
|
+
|
9
|
+
### 3.10.0 / 2020-10-30
|
10
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.9.4...v3.10.0)
|
11
|
+
|
12
|
+
No changes. Released to support other RSpec releases.
|
13
|
+
|
14
|
+
### 3.9.4 / 2020-10-23
|
15
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.9.3...v3.9.4)
|
16
|
+
|
17
|
+
Bug Fixes:
|
18
|
+
|
19
|
+
* Flag ripper as supported on Truffle Ruby. (Brandon Fish, #427)
|
20
|
+
* Prevent stubbing `File.read` from breaking source extraction.
|
21
|
+
(Jon Rowe, #431)
|
22
|
+
|
23
|
+
### 3.9.3 / 2020-05-02
|
24
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.9.2...v3.9.3)
|
25
|
+
|
26
|
+
Bug Fixes:
|
27
|
+
|
28
|
+
* Mark ripper as unsupported on Truffle Ruby. (Brandon Fish, #395)
|
29
|
+
* Mark ripper as unsupported on JRuby 9.2.0.0. (Brian Hawley, #400)
|
30
|
+
* Capture `Mutex.new` for our `RSpec::Support:Mutex` in order to
|
31
|
+
allow stubbing `Mutex.new`. (Jon Rowe, #411)
|
32
|
+
|
33
|
+
### 3.9.2 / 2019-12-30
|
34
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.9.1...v3.9.2)
|
35
|
+
|
36
|
+
Bug Fixes:
|
37
|
+
|
38
|
+
* Remove unneeded eval. (Matijs van Zuijlen, #394)
|
39
|
+
|
1
40
|
### 3.9.1 / 2019-12-28
|
41
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.9.0...v3.9.1)
|
2
42
|
|
3
43
|
Bug Fixes:
|
4
44
|
|
@@ -6,12 +46,14 @@ Bug Fixes:
|
|
6
46
|
(Jon Rowe, #392)
|
7
47
|
|
8
48
|
### 3.9.0 / 2019-10-07
|
49
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.8.3...v3.9.0)
|
9
50
|
|
10
51
|
*NO CHANGES*
|
11
52
|
|
12
53
|
Version 3.9.0 was released to allow other RSpec gems to release 3.9.0.
|
13
54
|
|
14
55
|
### 3.8.3 / 2019-10-02
|
56
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.8.2...v3.8.3)
|
15
57
|
|
16
58
|
Bug Fixes:
|
17
59
|
|
data/README.md
CHANGED
@@ -8,12 +8,12 @@ suitable for internal use only at this time.
|
|
8
8
|
|
9
9
|
Install one or more of the `RSpec` gems.
|
10
10
|
|
11
|
-
Want to run against the `
|
11
|
+
Want to run against the `main` branch? You'll need to include the dependent
|
12
12
|
RSpec repos as well. Add the following to your `Gemfile`:
|
13
13
|
|
14
14
|
```ruby
|
15
15
|
%w[rspec-core rspec-expectations rspec-mocks rspec-support].each do |lib|
|
16
|
-
gem lib, :git => "https://github.com/rspec/#{lib}.git", :branch => '
|
16
|
+
gem lib, :git => "https://github.com/rspec/#{lib}.git", :branch => 'main'
|
17
17
|
end
|
18
18
|
```
|
19
19
|
|
@@ -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
|
@@ -122,7 +122,7 @@ module RSpec
|
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
125
|
-
@max_non_kw_args = @min_non_kw_args
|
125
|
+
@max_non_kw_args = @min_non_kw_args + optional_non_kw_args
|
126
126
|
@allowed_kw_args = @required_kw_args + @optional_kw_args
|
127
127
|
end
|
128
128
|
else
|
@@ -285,7 +285,7 @@ module RSpec
|
|
285
285
|
@arbitrary_kw_args = @unlimited_args = false
|
286
286
|
end
|
287
287
|
|
288
|
-
def with_expectation(expectation) # rubocop:disable MethodLength
|
288
|
+
def with_expectation(expectation) # rubocop:disable MethodLength, Metrics/PerceivedComplexity
|
289
289
|
return self unless MethodSignatureExpectation === expectation
|
290
290
|
|
291
291
|
if expectation.empty?
|
@@ -43,7 +43,15 @@ module RSpec
|
|
43
43
|
|
44
44
|
if defined? ::Mutex
|
45
45
|
# On 1.9 and up, this is in core, so we just use the real one
|
46
|
-
Mutex
|
46
|
+
class Mutex < ::Mutex
|
47
|
+
# If you mock Mutex.new you break our usage of Mutex, so
|
48
|
+
# instead we capture the original method to return Mutexs.
|
49
|
+
NEW_MUTEX_METHOD = Mutex.method(:new)
|
50
|
+
|
51
|
+
def self.new
|
52
|
+
NEW_MUTEX_METHOD.call
|
53
|
+
end
|
54
|
+
end
|
47
55
|
else # For 1.8.7
|
48
56
|
# :nocov:
|
49
57
|
RSpec::Support.require_rspec_support "mutex"
|
@@ -7,7 +7,7 @@ module RSpec
|
|
7
7
|
#
|
8
8
|
# Provides query methods for different OS or OS features.
|
9
9
|
module OS
|
10
|
-
|
10
|
+
module_function
|
11
11
|
|
12
12
|
def windows?
|
13
13
|
!!(RbConfig::CONFIG['host_os'] =~ /cygwin|mswin|mingw|bccwin|wince|emx/)
|
@@ -22,7 +22,7 @@ module RSpec
|
|
22
22
|
#
|
23
23
|
# Provides query methods for different rubies
|
24
24
|
module Ruby
|
25
|
-
|
25
|
+
module_function
|
26
26
|
|
27
27
|
def jruby?
|
28
28
|
RUBY_PLATFORM == 'java'
|
@@ -47,6 +47,10 @@ module RSpec
|
|
47
47
|
def mri?
|
48
48
|
!defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby'
|
49
49
|
end
|
50
|
+
|
51
|
+
def truffleruby?
|
52
|
+
defined?(RUBY_ENGINE) && RUBY_ENGINE == 'truffleruby'
|
53
|
+
end
|
50
54
|
end
|
51
55
|
|
52
56
|
# @api private
|
@@ -54,9 +58,9 @@ module RSpec
|
|
54
58
|
# Provides query methods for ruby features that differ among
|
55
59
|
# implementations.
|
56
60
|
module RubyFeatures
|
57
|
-
|
61
|
+
module_function
|
58
62
|
|
59
|
-
if Ruby.jruby?
|
63
|
+
if Ruby.jruby? && RUBY_VERSION.to_f < 1.9
|
60
64
|
# On JRuby 1.7 `--1.8` mode, `Process.respond_to?(:fork)` returns true,
|
61
65
|
# but when you try to fork, it raises an error:
|
62
66
|
# NotImplementedError: fork is not available on this platform
|
@@ -107,7 +111,9 @@ module RSpec
|
|
107
111
|
ripper_requirements.push(Ruby.jruby_version >= '1.7.5')
|
108
112
|
# Ripper on JRuby 9.0.0.0.rc1 - 9.1.8.0 reports wrong line number
|
109
113
|
# or cannot parse source including `:if`.
|
110
|
-
|
114
|
+
# Ripper on JRuby 9.x.x.x < 9.1.17.0 can't handle keyword arguments
|
115
|
+
# Neither can JRuby 9.2, e.g. < 9.2.1.0
|
116
|
+
ripper_requirements.push(!Ruby.jruby_version.between?('9.0.0.0.rc1', '9.2.0.0'))
|
111
117
|
end
|
112
118
|
|
113
119
|
if ripper_requirements.all?
|
data/lib/rspec/support/source.rb
CHANGED
@@ -8,6 +8,16 @@ module RSpec
|
|
8
8
|
class Source
|
9
9
|
attr_reader :source, :path
|
10
10
|
|
11
|
+
# This class protects us against having File read and expand_path
|
12
|
+
# stubbed out within tests.
|
13
|
+
class File
|
14
|
+
class << self
|
15
|
+
[:read, :expand_path].each do |method_name|
|
16
|
+
define_method(method_name, &::File.method(method_name))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
11
21
|
def self.from_file(path)
|
12
22
|
source = File.read(path)
|
13
23
|
new(source, path)
|
data/lib/rspec/support/spec.rb
CHANGED
@@ -2,6 +2,7 @@ require 'rspec/support'
|
|
2
2
|
require 'rspec/support/spec/in_sub_process'
|
3
3
|
|
4
4
|
RSpec::Support.require_rspec_support "spec/deprecation_helpers"
|
5
|
+
RSpec::Support.require_rspec_support "spec/diff_helpers"
|
5
6
|
RSpec::Support.require_rspec_support "spec/with_isolated_stderr"
|
6
7
|
RSpec::Support.require_rspec_support "spec/stderr_splitter"
|
7
8
|
RSpec::Support.require_rspec_support "spec/formatting_support"
|
@@ -35,9 +36,9 @@ RSpec.configure do |c|
|
|
35
36
|
|
36
37
|
c.example_status_persistence_file_path = "./spec/examples.txt"
|
37
38
|
|
38
|
-
c.define_derived_metadata :
|
39
|
-
meta[:pending] ||= "This spec fails on
|
40
|
-
end if ENV['
|
39
|
+
c.define_derived_metadata :failing_on_windows_ci do |meta|
|
40
|
+
meta[:pending] ||= "This spec fails on Windows CI and needs someone to fix it."
|
41
|
+
end if RSpec::Support::OS.windows? && ENV['CI']
|
41
42
|
end
|
42
43
|
|
43
44
|
module RSpec
|
@@ -1,35 +1,22 @@
|
|
1
1
|
module RSpecHelpers
|
2
|
-
def expect_no_deprecation
|
3
|
-
expect(RSpec.configuration.reporter).not_to receive(:deprecation)
|
4
|
-
end
|
5
|
-
|
6
2
|
def expect_deprecation_with_call_site(file, line, snippet=//)
|
7
|
-
expect(RSpec.configuration.reporter).to receive(:deprecation)
|
8
|
-
|
9
|
-
expect(options[:deprecated]).to match(snippet)
|
10
|
-
end
|
3
|
+
expect(RSpec.configuration.reporter).to receive(:deprecation).
|
4
|
+
with(include(:deprecated => match(snippet), :call_site => include([file, line].join(':'))))
|
11
5
|
end
|
12
6
|
|
13
7
|
def expect_deprecation_without_call_site(snippet=//)
|
14
|
-
expect(RSpec.configuration.reporter).to receive(:deprecation)
|
15
|
-
|
16
|
-
expect(options[:deprecated]).to match(snippet)
|
17
|
-
end
|
8
|
+
expect(RSpec.configuration.reporter).to receive(:deprecation).
|
9
|
+
with(include(:deprecated => match(snippet), :call_site => eq(nil)))
|
18
10
|
end
|
19
11
|
|
20
12
|
def expect_warn_deprecation_with_call_site(file, line, snippet=//)
|
21
|
-
expect(RSpec.configuration.reporter).to receive(:deprecation)
|
22
|
-
message
|
23
|
-
expect(message).to match(snippet)
|
24
|
-
expect(message).to include([file, line].join(':'))
|
25
|
-
end
|
13
|
+
expect(RSpec.configuration.reporter).to receive(:deprecation).
|
14
|
+
with(include(:message => match(snippet), :call_site => include([file, line].join(':'))))
|
26
15
|
end
|
27
16
|
|
28
17
|
def expect_warn_deprecation(snippet=//)
|
29
|
-
expect(RSpec.configuration.reporter).to receive(:deprecation)
|
30
|
-
message
|
31
|
-
expect(message).to match(snippet)
|
32
|
-
end
|
18
|
+
expect(RSpec.configuration.reporter).to receive(:deprecation).
|
19
|
+
with(include(:message => match(snippet)))
|
33
20
|
end
|
34
21
|
|
35
22
|
def allow_deprecation
|
@@ -39,19 +26,16 @@ module RSpecHelpers
|
|
39
26
|
def expect_no_deprecations
|
40
27
|
expect(RSpec.configuration.reporter).not_to receive(:deprecation)
|
41
28
|
end
|
29
|
+
alias expect_no_deprecation expect_no_deprecations
|
42
30
|
|
43
31
|
def expect_warning_without_call_site(expected=//)
|
44
|
-
expect(::Kernel).to receive(:warn)
|
45
|
-
|
46
|
-
expect(message).to_not match(/Called from/)
|
47
|
-
end
|
32
|
+
expect(::Kernel).to receive(:warn).
|
33
|
+
with(match(expected).and(satisfy { |message| !(/Called from/ =~ message) }))
|
48
34
|
end
|
49
35
|
|
50
36
|
def expect_warning_with_call_site(file, line, expected=//)
|
51
|
-
expect(::Kernel).to receive(:warn)
|
52
|
-
|
53
|
-
expect(message).to match(/Called from #{file}:#{line}/)
|
54
|
-
end
|
37
|
+
expect(::Kernel).to receive(:warn).
|
38
|
+
with(match(expected).and(match(/Called from #{file}:#{line}/)))
|
55
39
|
end
|
56
40
|
|
57
41
|
def expect_no_warnings
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'diff/lcs'
|
2
|
+
|
3
|
+
module RSpec
|
4
|
+
module Support
|
5
|
+
module Spec
|
6
|
+
module DiffHelpers
|
7
|
+
# In the updated version of diff-lcs several diff headers change format slightly
|
8
|
+
# compensate for this and change minimum version in RSpec 4
|
9
|
+
if ::Diff::LCS::VERSION.to_f < 1.4
|
10
|
+
def one_line_header(line_number=2)
|
11
|
+
"-1,#{line_number} +1,#{line_number}"
|
12
|
+
end
|
13
|
+
else
|
14
|
+
def one_line_header(_=2)
|
15
|
+
"-1 +1"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
if Diff::LCS::VERSION.to_f < 1.4 || Diff::LCS::VERSION >= "1.4.4"
|
20
|
+
def removing_two_line_header
|
21
|
+
"-1,3 +1"
|
22
|
+
end
|
23
|
+
else
|
24
|
+
def removing_two_line_header
|
25
|
+
"-1,3 +1,5"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -7,8 +7,7 @@ module RSpec
|
|
7
7
|
|
8
8
|
# Useful as a way to isolate a global change to a subprocess.
|
9
9
|
|
10
|
-
# rubocop:disable MethodLength
|
11
|
-
def in_sub_process(prevent_warnings=true)
|
10
|
+
def in_sub_process(prevent_warnings=true) # rubocop:disable MethodLength, Metrics/AbcSize
|
12
11
|
exception_reader, exception_writer = IO.pipe
|
13
12
|
result_reader, result_writer = IO.pipe
|
14
13
|
|
@@ -46,7 +45,6 @@ module RSpec
|
|
46
45
|
result_reader.close
|
47
46
|
result
|
48
47
|
end
|
49
|
-
# rubocop:enable MethodLength
|
50
48
|
alias :in_sub_process_if_possible :in_sub_process
|
51
49
|
|
52
50
|
def marshal_dump_with_unmarshable_object_handling(object)
|
@@ -53,19 +53,35 @@ module RSpec
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
|
57
|
-
|
56
|
+
LINES_TO_IGNORE =
|
57
|
+
[
|
58
58
|
# Ignore bundler warning.
|
59
|
-
|
59
|
+
%r{bundler/source/rubygems},
|
60
60
|
# Ignore bundler + rubygems warning.
|
61
|
-
|
62
|
-
|
61
|
+
%r{site_ruby/\d\.\d\.\d/rubygems},
|
62
|
+
%r{jruby-\d\.\d\.\d+\.\d/lib/ruby/stdlib/rubygems},
|
63
63
|
# This is required for windows for some reason
|
64
|
-
|
64
|
+
%r{lib/bundler/rubygems},
|
65
65
|
# This is a JRuby file that generates warnings on 9.0.3.0
|
66
|
-
|
66
|
+
%r{lib/ruby/stdlib/jar},
|
67
67
|
# This is a JRuby file that generates warnings on 9.1.7.0
|
68
|
-
|
68
|
+
%r{org/jruby/RubyKernel\.java},
|
69
|
+
# This is a JRuby gem that generates warnings on 9.1.7.0
|
70
|
+
%r{ffi-1\.13\.\d+-java},
|
71
|
+
%r{uninitialized constant FFI},
|
72
|
+
# These are related to the above, there is a warning about io from FFI
|
73
|
+
%r{jruby-\d\.\d\.\d+\.\d/lib/ruby/stdlib/io},
|
74
|
+
%r{io/console on JRuby shells out to stty for most operations},
|
75
|
+
# This is a JRuby 9.1.17.0 error on Github Actions
|
76
|
+
%r{io/console not supported; tty will not be manipulated},
|
77
|
+
# This is a JRuby 9.2.1.x error
|
78
|
+
%r{jruby/kernel/gem_prelude},
|
79
|
+
%r{lib/jruby\.jar!/jruby/preludes},
|
80
|
+
]
|
81
|
+
|
82
|
+
def strip_known_warnings(input)
|
83
|
+
input.split("\n").reject do |l|
|
84
|
+
LINES_TO_IGNORE.any? { |to_ignore| l =~ to_ignore } ||
|
69
85
|
# Remove blank lines
|
70
86
|
l == "" || l.nil?
|
71
87
|
end.join("\n")
|
@@ -6,6 +6,7 @@ module RSpec
|
|
6
6
|
def initialize(original)
|
7
7
|
@orig_stderr = original
|
8
8
|
@output_tracker = ::StringIO.new
|
9
|
+
@last_line = nil
|
9
10
|
end
|
10
11
|
|
11
12
|
respond_to_name = (::RUBY_VERSION.to_f < 1.9) ? :respond_to? : :respond_to_missing?
|
@@ -38,12 +39,19 @@ module RSpec
|
|
38
39
|
def write(line)
|
39
40
|
return if line =~ %r{^\S+/gems/\S+:\d+: warning:} # http://rubular.com/r/kqeUIZOfPG
|
40
41
|
|
42
|
+
# Ruby 2.7.0 warnings from keyword argments span multiple lines, extend check above
|
43
|
+
# to look for the next line.
|
44
|
+
return if @last_line =~ %r{^\S+/gems/\S+:\d+: warning:} &&
|
45
|
+
line =~ %r{warning: The called method .* is defined here}
|
46
|
+
|
41
47
|
# Ruby 2.7.0 complains about hashes used in place of keyword arguments
|
42
48
|
# Aruba 0.14.2 uses this internally triggering that here
|
43
49
|
return if line =~ %r{lib/ruby/2\.7\.0/fileutils\.rb:622: warning:}
|
44
50
|
|
45
51
|
@orig_stderr.write(line)
|
46
52
|
@output_tracker.write(line)
|
53
|
+
ensure
|
54
|
+
@last_line = line
|
47
55
|
end
|
48
56
|
|
49
57
|
def has_output?
|
@@ -0,0 +1,33 @@
|
|
1
|
+
RSpec::Support.require_rspec_support("method_signature_verifier")
|
2
|
+
|
3
|
+
module RSpec
|
4
|
+
module Support
|
5
|
+
module WithKeywordsWhenNeeded
|
6
|
+
# This module adds keyword sensitive support for core ruby methods
|
7
|
+
# where we cannot use `ruby2_keywords` directly.
|
8
|
+
|
9
|
+
module_function
|
10
|
+
|
11
|
+
if RSpec::Support::RubyFeatures.kw_args_supported?
|
12
|
+
# Remove this in RSpec 4 in favour of explictly passed in kwargs where
|
13
|
+
# this is used. Works around a warning in Ruby 2.7
|
14
|
+
|
15
|
+
def class_exec(klass, *args, &block)
|
16
|
+
if MethodSignature.new(block).has_kw_args_in?(args)
|
17
|
+
binding.eval(<<-CODE, __FILE__, __LINE__)
|
18
|
+
kwargs = args.pop
|
19
|
+
klass.class_exec(*args, **kwargs, &block)
|
20
|
+
CODE
|
21
|
+
else
|
22
|
+
klass.class_exec(*args, &block)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
ruby2_keywords :class_exec if respond_to?(:ruby2_keywords, true)
|
26
|
+
else
|
27
|
+
def class_exec(klass, *args, &block)
|
28
|
+
klass.class_exec(*args, &block)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
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.
|
4
|
+
version: 3.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Chelimsky
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
- Sam Phippen
|
11
11
|
- Xaviery Shay
|
12
12
|
- Bradley Schaefer
|
13
|
-
autorequire:
|
13
|
+
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain:
|
16
16
|
- |
|
@@ -48,20 +48,20 @@ cert_chain:
|
|
48
48
|
ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
|
49
49
|
F3MdtaDehhjC
|
50
50
|
-----END CERTIFICATE-----
|
51
|
-
date:
|
51
|
+
date: 2020-12-27 00:00:00.000000000 Z
|
52
52
|
dependencies:
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: rake
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- - "
|
57
|
+
- - ">"
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: 10.0.0
|
60
60
|
type: :development
|
61
61
|
prerelease: false
|
62
62
|
version_requirements: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- - "
|
64
|
+
- - ">"
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: 10.0.0
|
67
67
|
- !ruby/object:Gem::Dependency
|
@@ -108,6 +108,7 @@ files:
|
|
108
108
|
- lib/rspec/support/source/token.rb
|
109
109
|
- lib/rspec/support/spec.rb
|
110
110
|
- lib/rspec/support/spec/deprecation_helpers.rb
|
111
|
+
- lib/rspec/support/spec/diff_helpers.rb
|
111
112
|
- lib/rspec/support/spec/formatting_support.rb
|
112
113
|
- lib/rspec/support/spec/in_sub_process.rb
|
113
114
|
- lib/rspec/support/spec/library_wide_checks.rb
|
@@ -118,16 +119,17 @@ files:
|
|
118
119
|
- lib/rspec/support/spec/with_isolated_stderr.rb
|
119
120
|
- lib/rspec/support/version.rb
|
120
121
|
- lib/rspec/support/warnings.rb
|
122
|
+
- lib/rspec/support/with_keywords_when_needed.rb
|
121
123
|
homepage: https://github.com/rspec/rspec-support
|
122
124
|
licenses:
|
123
125
|
- MIT
|
124
126
|
metadata:
|
125
127
|
bug_tracker_uri: https://github.com/rspec/rspec-support/issues
|
126
|
-
changelog_uri: https://github.com/rspec/rspec-support/blob/v3.
|
128
|
+
changelog_uri: https://github.com/rspec/rspec-support/blob/v3.10.1/Changelog.md
|
127
129
|
documentation_uri: https://rspec.info/documentation/
|
128
130
|
mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
|
129
131
|
source_code_uri: https://github.com/rspec/rspec-support
|
130
|
-
post_install_message:
|
132
|
+
post_install_message:
|
131
133
|
rdoc_options:
|
132
134
|
- "--charset=UTF-8"
|
133
135
|
require_paths:
|
@@ -143,8 +145,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
145
|
- !ruby/object:Gem::Version
|
144
146
|
version: '0'
|
145
147
|
requirements: []
|
146
|
-
rubygems_version: 3.
|
147
|
-
signing_key:
|
148
|
+
rubygems_version: 3.2.3
|
149
|
+
signing_key:
|
148
150
|
specification_version: 4
|
149
|
-
summary: rspec-support-3.
|
151
|
+
summary: rspec-support-3.10.1
|
150
152
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|