rspec-support 3.13.8 → 4.0.0.beta1
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 +18 -7
- data/LICENSE.md +9 -6
- data/README.md +6 -38
- data/lib/rspec/support/caller_filter.rb +36 -47
- data/lib/rspec/support/differ.rb +33 -14
- data/lib/rspec/support/directory_maker.rb +0 -2
- data/lib/rspec/support/encoded_string.rb +63 -80
- data/lib/rspec/support/fuzzy_matcher.rb +1 -2
- data/lib/rspec/support/method_signature_verifier.rb +87 -149
- data/lib/rspec/support/object_formatter.rb +3 -28
- data/lib/rspec/support/recursive_const_methods.rb +16 -39
- data/lib/rspec/support/reentrant_mutex.rb +16 -46
- data/lib/rspec/support/ruby_features.rb +16 -136
- data/lib/rspec/support/source.rb +3 -12
- data/lib/rspec/support/spec/coverage.rb +50 -0
- data/lib/rspec/support/spec/in_sub_process.rb +1 -1
- data/lib/rspec/support/spec/library_wide_checks.rb +9 -12
- data/lib/rspec/support/spec/shell_out.rb +3 -25
- data/lib/rspec/support/spec/stderr_splitter.rb +7 -20
- data/lib/rspec/support/spec/string_matcher.rb +18 -28
- data/lib/rspec/support/spec.rb +3 -42
- data/lib/rspec/support/version.rb +1 -1
- data/lib/rspec/support/with_keywords_when_needed.rb +8 -17
- data/lib/rspec/support.rb +17 -57
- data.tar.gz.sig +0 -0
- metadata +8 -38
- metadata.gz.sig +0 -0
- data/lib/rspec/support/mutex.rb +0 -75
- data/lib/rspec/support/spec/diff_helpers.rb +0 -45
- data/lib/rspec/support/spec/warnings.rb +0 -31
data/lib/rspec/support.rb
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
attr_accessor :__rspec_local_data
|
|
3
|
+
class Thread
|
|
4
|
+
attr_accessor :__rspec_local_data
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
end
|
|
6
|
+
class << self
|
|
7
|
+
alias __rspec_current_thread current
|
|
10
8
|
end
|
|
11
9
|
end
|
|
12
10
|
|
|
@@ -24,27 +22,13 @@ module RSpec
|
|
|
24
22
|
# hand, does a linear O(N) search over the dirs in the $LOAD_PATH until
|
|
25
23
|
# it can resolve the file relative to one of the dirs.
|
|
26
24
|
def self.define_optimized_require_for_rspec(lib, &require_relative)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if RUBY_PLATFORM == 'java' && !Kernel.respond_to?(:require)
|
|
30
|
-
# JRuby 9.1.17.0 has developed a regression for require
|
|
31
|
-
(class << self; self; end).__send__(:define_method, name) do |f|
|
|
32
|
-
Kernel.send(:require, "rspec/#{lib}/#{f}")
|
|
33
|
-
end
|
|
34
|
-
elsif Kernel.respond_to?(:require_relative)
|
|
35
|
-
(class << self; self; end).__send__(:define_method, name) do |f|
|
|
36
|
-
require_relative.call("#{lib}/#{f}")
|
|
37
|
-
end
|
|
38
|
-
else
|
|
39
|
-
(class << self; self; end).__send__(:define_method, name) do |f|
|
|
40
|
-
require "rspec/#{lib}/#{f}"
|
|
41
|
-
end
|
|
25
|
+
define_singleton_method("require_rspec_#{lib}") do |f|
|
|
26
|
+
require_relative.call("#{lib}/#{f}")
|
|
42
27
|
end
|
|
43
28
|
end
|
|
44
29
|
|
|
45
30
|
define_optimized_require_for_rspec(:support) { |f| require_relative(f) }
|
|
46
31
|
require_rspec_support "version"
|
|
47
|
-
require_rspec_support "ruby_features"
|
|
48
32
|
|
|
49
33
|
# @api private
|
|
50
34
|
KERNEL_METHOD_METHOD = ::Kernel.instance_method(:method)
|
|
@@ -60,33 +44,15 @@ module RSpec
|
|
|
60
44
|
# - BasicObject subclasses that mixin a Kernel dup (e.g. SimpleDelegator)
|
|
61
45
|
# - Objects that undefine method and delegate everything to another
|
|
62
46
|
# object (e.g. Mongoid association objects)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
raise original
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
else
|
|
76
|
-
def self.method_handle_for(object, method_name)
|
|
77
|
-
if ::Kernel === object
|
|
78
|
-
KERNEL_METHOD_METHOD.bind(object).call(method_name)
|
|
79
|
-
else
|
|
80
|
-
object.method(method_name)
|
|
81
|
-
end
|
|
82
|
-
rescue NameError => original
|
|
83
|
-
begin
|
|
84
|
-
handle = object.method(method_name)
|
|
85
|
-
raise original unless handle.is_a? Method
|
|
86
|
-
handle
|
|
87
|
-
rescue Support::AllExceptionsExceptOnesWeMustNotRescue
|
|
88
|
-
raise original
|
|
89
|
-
end
|
|
47
|
+
def self.method_handle_for(object, method_name)
|
|
48
|
+
KERNEL_METHOD_METHOD.bind(object).call(method_name)
|
|
49
|
+
rescue NameError => original
|
|
50
|
+
begin
|
|
51
|
+
handle = object.method(method_name)
|
|
52
|
+
raise original unless handle.is_a? Method
|
|
53
|
+
handle
|
|
54
|
+
rescue Support::AllExceptionsExceptOnesWeMustNotRescue
|
|
55
|
+
raise original
|
|
90
56
|
end
|
|
91
57
|
end
|
|
92
58
|
|
|
@@ -101,14 +67,8 @@ module RSpec
|
|
|
101
67
|
end
|
|
102
68
|
|
|
103
69
|
# A single thread local variable so we don't excessively pollute that namespace.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
Thread.__rspec_current_thread.__rspec_local_data ||= {}
|
|
107
|
-
end
|
|
108
|
-
else
|
|
109
|
-
def self.thread_local_data
|
|
110
|
-
Thread.current[:__rspec] ||= {}
|
|
111
|
-
end
|
|
70
|
+
def self.thread_local_data
|
|
71
|
+
Thread.__rspec_current_thread.__rspec_local_data ||= {}
|
|
112
72
|
end
|
|
113
73
|
|
|
114
74
|
# @api private
|
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:
|
|
4
|
+
version: 4.0.0.beta1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Chelimsky
|
|
@@ -47,35 +47,7 @@ cert_chain:
|
|
|
47
47
|
x0Qexp5yGeoxAL9qKM/RXYKtuRZBJV1z+L9A1YOtwaXXNg==
|
|
48
48
|
-----END CERTIFICATE-----
|
|
49
49
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
50
|
-
dependencies:
|
|
51
|
-
- !ruby/object:Gem::Dependency
|
|
52
|
-
name: rake
|
|
53
|
-
requirement: !ruby/object:Gem::Requirement
|
|
54
|
-
requirements:
|
|
55
|
-
- - ">"
|
|
56
|
-
- !ruby/object:Gem::Version
|
|
57
|
-
version: 10.0.0
|
|
58
|
-
type: :development
|
|
59
|
-
prerelease: false
|
|
60
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
61
|
-
requirements:
|
|
62
|
-
- - ">"
|
|
63
|
-
- !ruby/object:Gem::Version
|
|
64
|
-
version: 10.0.0
|
|
65
|
-
- !ruby/object:Gem::Dependency
|
|
66
|
-
name: thread_order
|
|
67
|
-
requirement: !ruby/object:Gem::Requirement
|
|
68
|
-
requirements:
|
|
69
|
-
- - "~>"
|
|
70
|
-
- !ruby/object:Gem::Version
|
|
71
|
-
version: 1.1.0
|
|
72
|
-
type: :development
|
|
73
|
-
prerelease: false
|
|
74
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
75
|
-
requirements:
|
|
76
|
-
- - "~>"
|
|
77
|
-
- !ruby/object:Gem::Version
|
|
78
|
-
version: 1.1.0
|
|
50
|
+
dependencies: []
|
|
79
51
|
description: Support utilities for RSpec gems
|
|
80
52
|
email: rspec-users@rubyforge.org
|
|
81
53
|
executables: []
|
|
@@ -95,7 +67,6 @@ files:
|
|
|
95
67
|
- lib/rspec/support/hunk_generator.rb
|
|
96
68
|
- lib/rspec/support/matcher_definition.rb
|
|
97
69
|
- lib/rspec/support/method_signature_verifier.rb
|
|
98
|
-
- lib/rspec/support/mutex.rb
|
|
99
70
|
- lib/rspec/support/object_formatter.rb
|
|
100
71
|
- lib/rspec/support/recursive_const_methods.rb
|
|
101
72
|
- lib/rspec/support/reentrant_mutex.rb
|
|
@@ -105,15 +76,14 @@ files:
|
|
|
105
76
|
- lib/rspec/support/source/node.rb
|
|
106
77
|
- lib/rspec/support/source/token.rb
|
|
107
78
|
- lib/rspec/support/spec.rb
|
|
79
|
+
- lib/rspec/support/spec/coverage.rb
|
|
108
80
|
- lib/rspec/support/spec/deprecation_helpers.rb
|
|
109
|
-
- lib/rspec/support/spec/diff_helpers.rb
|
|
110
81
|
- lib/rspec/support/spec/formatting_support.rb
|
|
111
82
|
- lib/rspec/support/spec/in_sub_process.rb
|
|
112
83
|
- lib/rspec/support/spec/library_wide_checks.rb
|
|
113
84
|
- lib/rspec/support/spec/shell_out.rb
|
|
114
85
|
- lib/rspec/support/spec/stderr_splitter.rb
|
|
115
86
|
- lib/rspec/support/spec/string_matcher.rb
|
|
116
|
-
- lib/rspec/support/spec/warnings.rb
|
|
117
87
|
- lib/rspec/support/spec/with_isolated_directory.rb
|
|
118
88
|
- lib/rspec/support/spec/with_isolated_stderr.rb
|
|
119
89
|
- lib/rspec/support/version.rb
|
|
@@ -124,11 +94,11 @@ licenses:
|
|
|
124
94
|
- MIT
|
|
125
95
|
metadata:
|
|
126
96
|
bug_tracker_uri: https://github.com/rspec/rspec/issues
|
|
127
|
-
changelog_uri: https://github.com/rspec/rspec/
|
|
97
|
+
changelog_uri: https://github.com/rspec/rspec/tree/rspec-support-v4.0.0.beta1/rspec-support/Changelog.md
|
|
128
98
|
documentation_uri: https://rspec.info/documentation/
|
|
129
99
|
mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
|
|
130
100
|
rubygems_mfa_required: 'true'
|
|
131
|
-
source_code_uri: https://github.com/rspec/rspec/
|
|
101
|
+
source_code_uri: https://github.com/rspec/rspec/tree/rspec-support-v4.0.0.beta1/rspec-support
|
|
132
102
|
rdoc_options:
|
|
133
103
|
- "--charset=UTF-8"
|
|
134
104
|
require_paths:
|
|
@@ -137,14 +107,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
137
107
|
requirements:
|
|
138
108
|
- - ">="
|
|
139
109
|
- !ruby/object:Gem::Version
|
|
140
|
-
version:
|
|
110
|
+
version: 3.0.0
|
|
141
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
112
|
requirements:
|
|
143
113
|
- - ">="
|
|
144
114
|
- !ruby/object:Gem::Version
|
|
145
115
|
version: '0'
|
|
146
116
|
requirements: []
|
|
147
|
-
rubygems_version: 4.0.
|
|
117
|
+
rubygems_version: 4.0.3
|
|
148
118
|
specification_version: 4
|
|
149
|
-
summary: rspec-support-
|
|
119
|
+
summary: rspec-support-4.0.0.beta1
|
|
150
120
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|
data/lib/rspec/support/mutex.rb
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module RSpec
|
|
4
|
-
module Support
|
|
5
|
-
# On 1.8.7, it's in the stdlib.
|
|
6
|
-
# We don't want to load the stdlib, b/c this is a test tool, and can affect
|
|
7
|
-
# the test environment, causing tests to pass where they should fail.
|
|
8
|
-
#
|
|
9
|
-
# So we're transcribing/modifying it from
|
|
10
|
-
# https://github.com/ruby/ruby/blob/v1_8_7_374/lib/thread.rb#L56
|
|
11
|
-
# Some methods we don't need are deleted. Anything I don't
|
|
12
|
-
# understand (there's quite a bit, actually) is left in.
|
|
13
|
-
#
|
|
14
|
-
# Some formatting changes are made to appease the robot overlord:
|
|
15
|
-
# https://travis-ci.org/rspec/rspec-core/jobs/54410874
|
|
16
|
-
# @private
|
|
17
|
-
class Mutex
|
|
18
|
-
def initialize
|
|
19
|
-
@waiting = []
|
|
20
|
-
@locked = false
|
|
21
|
-
@waiting.taint
|
|
22
|
-
taint
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
# @private
|
|
26
|
-
def lock
|
|
27
|
-
while Thread.critical = true && @locked
|
|
28
|
-
@waiting.push Thread.current
|
|
29
|
-
Thread.stop
|
|
30
|
-
end
|
|
31
|
-
@locked = true
|
|
32
|
-
Thread.critical = false
|
|
33
|
-
self
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
# @private
|
|
37
|
-
def unlock
|
|
38
|
-
return unless @locked
|
|
39
|
-
Thread.critical = true
|
|
40
|
-
@locked = false
|
|
41
|
-
wakeup_and_run_waiting_thread
|
|
42
|
-
self
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
# @private
|
|
46
|
-
def synchronize
|
|
47
|
-
lock
|
|
48
|
-
begin
|
|
49
|
-
yield
|
|
50
|
-
ensure
|
|
51
|
-
unlock
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
private
|
|
56
|
-
|
|
57
|
-
def wakeup_and_run_waiting_thread
|
|
58
|
-
begin
|
|
59
|
-
t = @waiting.shift
|
|
60
|
-
t.wakeup if t
|
|
61
|
-
rescue ThreadError
|
|
62
|
-
retry
|
|
63
|
-
end
|
|
64
|
-
Thread.critical = false
|
|
65
|
-
begin
|
|
66
|
-
t.run if t
|
|
67
|
-
rescue ThreadError
|
|
68
|
-
:noop
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
# Avoid warnings for library wide checks spec
|
|
73
|
-
end unless defined?(::RSpec::Support::Mutex) || defined?(::Mutex)
|
|
74
|
-
end
|
|
75
|
-
end
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'diff/lcs'
|
|
4
|
-
|
|
5
|
-
module RSpec
|
|
6
|
-
module Support
|
|
7
|
-
module Spec
|
|
8
|
-
module DiffHelpers
|
|
9
|
-
# In the updated version of diff-lcs several diff headers change format slightly
|
|
10
|
-
# compensate for this and change minimum version in RSpec 4
|
|
11
|
-
if ::Diff::LCS::VERSION.to_f < 1.4
|
|
12
|
-
def one_line_header(line_number=2)
|
|
13
|
-
"-1,#{line_number} +1,#{line_number}"
|
|
14
|
-
end
|
|
15
|
-
elsif ::Diff::LCS::VERSION.to_f < 1.6
|
|
16
|
-
def one_line_header(_=2)
|
|
17
|
-
"-1 +1"
|
|
18
|
-
end
|
|
19
|
-
else
|
|
20
|
-
def one_line_header(line_number=2)
|
|
21
|
-
if line_number - 1 == 1
|
|
22
|
-
"-1 +1"
|
|
23
|
-
else
|
|
24
|
-
"-1,#{line_number - 1} +1,#{line_number - 1}"
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
if ::Diff::LCS::VERSION.to_f > 1.5
|
|
30
|
-
def removing_two_line_header
|
|
31
|
-
"-1,2 +0,0"
|
|
32
|
-
end
|
|
33
|
-
elsif Diff::LCS::VERSION.to_f < 1.4 || Diff::LCS::VERSION >= "1.4.4"
|
|
34
|
-
def removing_two_line_header
|
|
35
|
-
"-1,3 +1"
|
|
36
|
-
end
|
|
37
|
-
else
|
|
38
|
-
def removing_two_line_header
|
|
39
|
-
"-1,3 +1,5"
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
RSpec::Support.require_rspec_support "ruby_features"
|
|
4
|
-
|
|
5
|
-
module RSpec
|
|
6
|
-
module Support
|
|
7
|
-
module Spec
|
|
8
|
-
module Warnings
|
|
9
|
-
if RUBY_VERSION.to_f > 2.6
|
|
10
|
-
SUPPORTED_WARNINGS =
|
|
11
|
-
[
|
|
12
|
-
:deprecated,
|
|
13
|
-
:experimental
|
|
14
|
-
]
|
|
15
|
-
SUPPORTED_WARNINGS << :strict_unused_block if RUBY_VERSION.to_f >= 3.4 && !RSpec::Support::Ruby.jruby?
|
|
16
|
-
SUPPORTED_WARNINGS.freeze
|
|
17
|
-
|
|
18
|
-
def self.setup
|
|
19
|
-
SUPPORTED_WARNINGS.each do |flag|
|
|
20
|
-
Warning[flag] = true
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
else
|
|
24
|
-
def self.setup
|
|
25
|
-
# Skip this check on Ruby 2.6 and below
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|