rspec-support 3.13.6 → 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.
data/lib/rspec/support.rb CHANGED
@@ -1,5 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ class Thread
4
+ attr_accessor :__rspec_local_data
5
+
6
+ class << self
7
+ alias __rspec_current_thread current
8
+ end
9
+ end
10
+
3
11
  module RSpec
4
12
  module Support
5
13
  # @api private
@@ -14,27 +22,13 @@ module RSpec
14
22
  # hand, does a linear O(N) search over the dirs in the $LOAD_PATH until
15
23
  # it can resolve the file relative to one of the dirs.
16
24
  def self.define_optimized_require_for_rspec(lib, &require_relative)
17
- name = "require_rspec_#{lib}"
18
-
19
- if RUBY_PLATFORM == 'java' && !Kernel.respond_to?(:require)
20
- # JRuby 9.1.17.0 has developed a regression for require
21
- (class << self; self; end).__send__(:define_method, name) do |f|
22
- Kernel.send(:require, "rspec/#{lib}/#{f}")
23
- end
24
- elsif Kernel.respond_to?(:require_relative)
25
- (class << self; self; end).__send__(:define_method, name) do |f|
26
- require_relative.call("#{lib}/#{f}")
27
- end
28
- else
29
- (class << self; self; end).__send__(:define_method, name) do |f|
30
- require "rspec/#{lib}/#{f}"
31
- end
25
+ define_singleton_method("require_rspec_#{lib}") do |f|
26
+ require_relative.call("#{lib}/#{f}")
32
27
  end
33
28
  end
34
29
 
35
30
  define_optimized_require_for_rspec(:support) { |f| require_relative(f) }
36
31
  require_rspec_support "version"
37
- require_rspec_support "ruby_features"
38
32
 
39
33
  # @api private
40
34
  KERNEL_METHOD_METHOD = ::Kernel.instance_method(:method)
@@ -50,33 +44,15 @@ module RSpec
50
44
  # - BasicObject subclasses that mixin a Kernel dup (e.g. SimpleDelegator)
51
45
  # - Objects that undefine method and delegate everything to another
52
46
  # object (e.g. Mongoid association objects)
53
- if RubyFeatures.supports_rebinding_module_methods?
54
- def self.method_handle_for(object, method_name)
55
- KERNEL_METHOD_METHOD.bind(object).call(method_name)
56
- rescue NameError => original
57
- begin
58
- handle = object.method(method_name)
59
- raise original unless handle.is_a? Method
60
- handle
61
- rescue Support::AllExceptionsExceptOnesWeMustNotRescue
62
- raise original
63
- end
64
- end
65
- else
66
- def self.method_handle_for(object, method_name)
67
- if ::Kernel === object
68
- KERNEL_METHOD_METHOD.bind(object).call(method_name)
69
- else
70
- object.method(method_name)
71
- end
72
- rescue NameError => original
73
- begin
74
- handle = object.method(method_name)
75
- raise original unless handle.is_a? Method
76
- handle
77
- rescue Support::AllExceptionsExceptOnesWeMustNotRescue
78
- raise original
79
- 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
80
56
  end
81
57
  end
82
58
 
@@ -91,14 +67,8 @@ module RSpec
91
67
  end
92
68
 
93
69
  # A single thread local variable so we don't excessively pollute that namespace.
94
- if RUBY_VERSION.to_f >= 2
95
- def self.thread_local_data
96
- Thread.current.thread_variable_get(:__rspec) || Thread.current.thread_variable_set(:__rspec, {})
97
- end
98
- else
99
- def self.thread_local_data
100
- Thread.current[:__rspec] ||= {}
101
- end
70
+ def self.thread_local_data
71
+ Thread.__rspec_current_thread.__rspec_local_data ||= {}
102
72
  end
103
73
 
104
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: 3.13.6
4
+ version: 4.0.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Chelimsky
@@ -14,11 +14,11 @@ bindir: bin
14
14
  cert_chain:
15
15
  - |
16
16
  -----BEGIN CERTIFICATE-----
17
- MIIFvjCCA6agAwIBAgIJAPXjfUbCjdXVMA0GCSq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lJ7jfv3u5TPt4JWzDP7oDPf3nXNiF2Cn48Ne598G5lHH6Heyxe39
44
+ pYZdhEptKJWPHxbJWHXD02omKprkNuQKHpnXrW+mmbiO4IcqAMggiud+DaEQg20x
45
+ Dae4cNbvK5p3D+5xqvcEO2G4uCMDmJjrSd61kvTLBnm1qroHqrpi9GauEVWZZmD0
46
+ n0ph8oFAXOsKQWxZ+4uh6yGISk+WhngCZEVPZUjq7SIGAuVhQy2ZgwdjnLEz//lD
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,8 +76,8 @@ 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
@@ -123,11 +94,11 @@ licenses:
123
94
  - MIT
124
95
  metadata:
125
96
  bug_tracker_uri: https://github.com/rspec/rspec/issues
126
- changelog_uri: https://github.com/rspec/rspec/blob/rspec-support-v3.13.6/rspec-support/Changelog.md
97
+ changelog_uri: https://github.com/rspec/rspec/tree/rspec-support-v4.0.0.beta1/rspec-support/Changelog.md
127
98
  documentation_uri: https://rspec.info/documentation/
128
99
  mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
129
100
  rubygems_mfa_required: 'true'
130
- source_code_uri: https://github.com/rspec/rspec/blob/rspec-support-v3.13.6/rspec-support
101
+ source_code_uri: https://github.com/rspec/rspec/tree/rspec-support-v4.0.0.beta1/rspec-support
131
102
  rdoc_options:
132
103
  - "--charset=UTF-8"
133
104
  require_paths:
@@ -136,14 +107,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
136
107
  requirements:
137
108
  - - ">="
138
109
  - !ruby/object:Gem::Version
139
- version: 1.8.7
110
+ version: 3.0.0
140
111
  required_rubygems_version: !ruby/object:Gem::Requirement
141
112
  requirements:
142
113
  - - ">="
143
114
  - !ruby/object:Gem::Version
144
115
  version: '0'
145
116
  requirements: []
146
- rubygems_version: 3.6.7
117
+ rubygems_version: 4.0.3
147
118
  specification_version: 4
148
- summary: rspec-support-3.13.6
119
+ summary: rspec-support-4.0.0.beta1
149
120
  test_files: []
metadata.gz.sig CHANGED
Binary file
@@ -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