rspec-support 3.12.0 → 3.12.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/Changelog.md +21 -3
  4. data/lib/rspec/support/caller_filter.rb +2 -0
  5. data/lib/rspec/support/comparable_version.rb +2 -0
  6. data/lib/rspec/support/differ.rb +2 -0
  7. data/lib/rspec/support/directory_maker.rb +2 -0
  8. data/lib/rspec/support/encoded_string.rb +2 -0
  9. data/lib/rspec/support/fuzzy_matcher.rb +2 -0
  10. data/lib/rspec/support/hunk_generator.rb +2 -0
  11. data/lib/rspec/support/matcher_definition.rb +2 -0
  12. data/lib/rspec/support/method_signature_verifier.rb +7 -3
  13. data/lib/rspec/support/mutex.rb +2 -0
  14. data/lib/rspec/support/object_formatter.rb +2 -0
  15. data/lib/rspec/support/recursive_const_methods.rb +2 -0
  16. data/lib/rspec/support/reentrant_mutex.rb +3 -1
  17. data/lib/rspec/support/ruby_features.rb +13 -0
  18. data/lib/rspec/support/source/location.rb +2 -0
  19. data/lib/rspec/support/source/node.rb +2 -0
  20. data/lib/rspec/support/source/token.rb +2 -0
  21. data/lib/rspec/support/source.rb +2 -0
  22. data/lib/rspec/support/spec/deprecation_helpers.rb +2 -0
  23. data/lib/rspec/support/spec/diff_helpers.rb +2 -0
  24. data/lib/rspec/support/spec/formatting_support.rb +2 -0
  25. data/lib/rspec/support/spec/in_sub_process.rb +6 -0
  26. data/lib/rspec/support/spec/library_wide_checks.rb +2 -0
  27. data/lib/rspec/support/spec/shell_out.rb +5 -0
  28. data/lib/rspec/support/spec/stderr_splitter.rb +2 -0
  29. data/lib/rspec/support/spec/string_matcher.rb +2 -0
  30. data/lib/rspec/support/spec/with_isolated_directory.rb +2 -0
  31. data/lib/rspec/support/spec/with_isolated_stderr.rb +2 -0
  32. data/lib/rspec/support/spec.rb +2 -0
  33. data/lib/rspec/support/version.rb +3 -1
  34. data/lib/rspec/support/warnings.rb +2 -0
  35. data/lib/rspec/support/with_keywords_when_needed.rb +2 -0
  36. data/lib/rspec/support.rb +10 -2
  37. data.tar.gz.sig +0 -0
  38. metadata +8 -8
  39. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5542244493fabc5ed010fb15a2df9ecbe1098e2e9a9ae92a81d4cc126ef2c31f
4
- data.tar.gz: 47743f4bd2b89824843b3112999a6bf733ea6bc0c1305917048cf0fa341e9e6b
3
+ metadata.gz: 7e32b81777527bad6ef4855860ca53dca983f5d75d369f60e0c9e53fd6a26bdc
4
+ data.tar.gz: aceab698cb5dc8d00631a4abbdaccfeecdcc6dc5c4b79b5a706f231d3d86d25c
5
5
  SHA512:
6
- metadata.gz: e672b3b674c957f99e534406df56dc7417619ca44015378434a3e98e9be91ca8f81509ab0b6bba2ad460047ce74da8fb88d225d9ad3a3b6a8676a977971dd4d9
7
- data.tar.gz: aee8eb87ddeef4c23b83e5a73b5fa450d360f0671ba796e4471e16be2daf34b804b62764d703c750bbacbd96243e3f100676d54be034f62fc1a052e5c8d90482
6
+ metadata.gz: 51ddfd24163bd5dd4cbd3e43dd6fe440246db96bcd4ae83460fa72d79e63f54ba36b7de5d3cf5ee323e30893803031260311b775387c6d4e430886afd2c0f5c7
7
+ data.tar.gz: 075cbdf1f30acf75e081f2852067de798f2d93b3d5a89b5391180ea0f10fb21e9bd25d2af6900c647640e9b7e8ca6fa3918c7af037690c2f00b5ac1a360894f5
checksums.yaml.gz.sig CHANGED
Binary file
data/Changelog.md CHANGED
@@ -1,5 +1,23 @@
1
1
  ### Development
2
- [Full Changelog](http://github.com/rspec/rspec-support/compare/v3.12.0...3-12-maintenance)
2
+ [Full Changelog](http://github.com/rspec/rspec-support/compare/v3.12.2...3-12-maintenance)
3
+
4
+ ### 3.12.2 / 2024-02-04
5
+ [Full Changelog](http://github.com/rspec/rspec-support/compare/v3.12.1...v3.12.2)
6
+
7
+ Bug Fixes:
8
+
9
+ * Properly surface errors from `in_sub_process`. (Jon Rowe, #575)
10
+ * Add magic comment for freezing string literals. (Josh Nichols, #586)
11
+ * Allow string keys for keyword arguments during verification of method
12
+ signatures, (but only on Ruby 3+). (@malcolmohare, #591)
13
+
14
+ ### 3.12.1 / 2023-06-26
15
+ [Full Changelog](http://github.com/rspec/rspec-support/compare/v3.12.0...v3.12.1)
16
+
17
+ Bug Fixes:
18
+
19
+ * Fix `RSpec::Support.thread_local_data` to be Thread local but not Fiber local.
20
+ (Jon Rowe, #581)
3
21
 
4
22
  ### 3.12.0 / 2022-10-26
5
23
  [Full Changelog](http://github.com/rspec/rspec-support/compare/v3.11.1...v3.12.0)
@@ -118,7 +136,7 @@ Bug Fixes:
118
136
  Bug Fixes:
119
137
 
120
138
  * Ensure that inspecting a `SimpleDelegator` based object works regardless of
121
- visibilty of the `__getobj__` method. (Jon Rowe, #369)
139
+ visibility of the `__getobj__` method. (Jon Rowe, #369)
122
140
 
123
141
  ### 3.8.0 / 2018-08-04
124
142
  [Full Changelog](http://github.com/rspec/rspec-support/compare/v3.7.1...v3.8.0)
@@ -226,7 +244,7 @@ Changes:
226
244
 
227
245
  Enhancements:
228
246
 
229
- * Improve formatting of `Delegator` based objects (e.g. `SimpleDelgator`) in
247
+ * Improve formatting of `Delegator` based objects (e.g. `SimpleDelegator`) in
230
248
  failure messages and diffs. (Andrew Horner, #215)
231
249
  * Add `ComparableVersion`. (Yuji Nakayama, #245)
232
250
  * Add `Ripper` support detection. (Yuji Nakayama, #245)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec::Support.require_rspec_support "ruby_features"
2
4
 
3
5
  module RSpec
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RSpec
2
4
  module Support
3
5
  # @private
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec::Support.require_rspec_support 'encoded_string'
2
4
  RSpec::Support.require_rspec_support 'hunk_generator'
3
5
  RSpec::Support.require_rspec_support "object_formatter"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec::Support.require_rspec_support 'ruby_features'
2
4
 
3
5
  module RSpec
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RSpec
2
4
  module Support
3
5
  # @private
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RSpec
2
4
  module Support
3
5
  # Provides a means to fuzzy-match between two arbitrary objects.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'diff/lcs'
2
4
  require 'diff/lcs/hunk'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RSpec
2
4
  module Support
3
5
  # @private
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rspec/support'
2
4
  RSpec::Support.require_rspec_support "ruby_features"
3
5
  RSpec::Support.require_rspec_support "matcher_definition"
@@ -82,7 +84,7 @@ module RSpec
82
84
  def has_kw_args_in?(args)
83
85
  Hash === args.last &&
84
86
  could_contain_kw_args?(args) &&
85
- (args.last.empty? || args.last.keys.any? { |x| x.is_a?(Symbol) })
87
+ (RubyFeatures.kw_arg_separation? || args.last.empty? || args.last.keys.any? { |x| x.is_a?(Symbol) })
86
88
  end
87
89
 
88
90
  # Without considering what the last arg is, could it
@@ -361,7 +363,7 @@ module RSpec
361
363
  end
362
364
 
363
365
  def split_args(*args)
364
- kw_args = if @signature.has_kw_args_in?(args)
366
+ kw_args = if @signature.has_kw_args_in?(args) && !RubyFeatures.kw_arg_separation?
365
367
  last = args.pop
366
368
  non_kw_args = last.reject { |k, _| k.is_a?(Symbol) }
367
369
  if non_kw_args.empty?
@@ -370,6 +372,8 @@ module RSpec
370
372
  args << non_kw_args
371
373
  last.select { |k, _| k.is_a?(Symbol) }.keys
372
374
  end
375
+ elsif @signature.has_kw_args_in?(args) && RubyFeatures.kw_arg_separation?
376
+ args.pop.keys
373
377
  else
374
378
  []
375
379
  end
@@ -378,7 +382,7 @@ module RSpec
378
382
  end
379
383
  end
380
384
 
381
- # Figures out wether a given method can accept various arguments.
385
+ # Figures out whether a given method can accept various arguments.
382
386
  # Surprisingly non-trivial.
383
387
  #
384
388
  # @private
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RSpec
2
4
  module Support
3
5
  # On 1.8.7, it's in the stdlib.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec::Support.require_rspec_support 'matcher_definition'
2
4
 
3
5
  module RSpec
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RSpec
2
4
  module Support
3
5
  # Provides recursive constant lookup methods useful for
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RSpec
2
4
  module Support
3
5
  # Allows a thread to lock out other threads from a critical section of code,
@@ -62,7 +64,7 @@ module RSpec
62
64
  # On 1.9 and up, this is in core, so we just use the real one
63
65
  class Mutex < ::Mutex
64
66
  # If you mock Mutex.new you break our usage of Mutex, so
65
- # instead we capture the original method to return Mutexs.
67
+ # instead we capture the original method to return Mutexes.
66
68
  NEW_MUTEX_METHOD = Mutex.method(:new)
67
69
 
68
70
  def self.new
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rbconfig'
2
4
  RSpec::Support.require_rspec_support "comparable_version"
3
5
 
@@ -94,6 +96,17 @@ module RSpec
94
96
  end
95
97
  end
96
98
 
99
+ if RUBY_VERSION.to_f >= 3.0
100
+ # https://rubyreferences.github.io/rubychanges/3.0.html#keyword-arguments-are-now-fully-separated-from-positional-arguments
101
+ def kw_arg_separation?
102
+ true
103
+ end
104
+ else
105
+ def kw_arg_separation?
106
+ false
107
+ end
108
+ end
109
+
97
110
  if RUBY_VERSION.to_f >= 2.7
98
111
  def supports_taint?
99
112
  false
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RSpec
2
4
  module Support
3
5
  class Source
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec::Support.require_rspec_support 'source/location'
2
4
 
3
5
  module RSpec
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec::Support.require_rspec_support 'source/location'
2
4
 
3
5
  module RSpec
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec::Support.require_rspec_support 'encoded_string'
2
4
  RSpec::Support.require_rspec_support 'ruby_features'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RSpecHelpers
2
4
  def expect_deprecation_with_call_site(file, line, snippet=//)
3
5
  expect(RSpec.configuration.reporter).to receive(:deprecation).
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'diff/lcs'
2
4
 
3
5
  module RSpec
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RSpec
2
4
  module Support
3
5
  module FormattingSupport
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RSpec
2
4
  module Support
3
5
  module InSubProcess
@@ -11,6 +13,10 @@ module RSpec
11
13
  exception_reader, exception_writer = IO.pipe
12
14
  result_reader, result_writer = IO.pipe
13
15
 
16
+ # Set binary mode to avoid errors surrounding ascii-8bit to utf-8 conversion
17
+ # this happens with warnings on rspec-rails for example
18
+ [exception_reader, exception_writer, result_reader, result_writer].each { |io| io.binmode }
19
+
14
20
  pid = Process.fork do
15
21
  warning_preventer = $stderr = RSpec::Support::StdErrSplitter.new($stderr)
16
22
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rspec/support/spec/shell_out'
2
4
 
3
5
  module RSpec
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'open3'
2
4
  require 'rake/file_utils'
3
5
  require 'shellwords'
@@ -77,6 +79,9 @@ module RSpec
77
79
  # This is a JRuby 9.2.1.x error
78
80
  %r{jruby/kernel/gem_prelude},
79
81
  %r{lib/jruby\.jar!/jruby/preludes},
82
+ # Ignore some JRuby errors for gems
83
+ %r{jruby/\d\.\d(\.\d)?/gems/aruba},
84
+ %r{jruby/\d\.\d(\.\d)?/gems/ffi},
80
85
  ]
81
86
 
82
87
  def strip_known_warnings(input)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'stringio'
2
4
 
3
5
  module RSpec
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rspec/matchers'
2
4
  # Special matcher for comparing encoded strings so that
3
5
  # we don't run any expectation failures through the Differ,
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'tmpdir'
2
4
 
3
5
  RSpec.shared_context "isolated directory" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RSpec
2
4
  module Support
3
5
  module WithIsolatedStdErr
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rspec/support'
2
4
  require 'rspec/support/spec/in_sub_process'
3
5
 
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RSpec
2
4
  module Support
3
5
  module Version
4
- STRING = '3.12.0'
6
+ STRING = '3.12.2'
5
7
  end
6
8
  end
7
9
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rspec/support'
2
4
  RSpec::Support.require_rspec_support "caller_filter"
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec::Support.require_rspec_support("method_signature_verifier")
2
4
 
3
5
  module RSpec
data/lib/rspec/support.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RSpec
2
4
  module Support
3
5
  # @api private
@@ -89,8 +91,14 @@ module RSpec
89
91
  end
90
92
 
91
93
  # A single thread local variable so we don't excessively pollute that namespace.
92
- def self.thread_local_data
93
- Thread.current[:__rspec] ||= {}
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
94
102
  end
95
103
 
96
104
  # @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.12.0
4
+ version: 3.12.2
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,7 +48,7 @@ cert_chain:
48
48
  ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
49
49
  F3MdtaDehhjC
50
50
  -----END CERTIFICATE-----
51
- date: 2022-10-26 00:00:00.000000000 Z
51
+ date: 2024-02-04 00:00:00.000000000 Z
52
52
  dependencies:
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: rake
@@ -125,11 +125,11 @@ licenses:
125
125
  - MIT
126
126
  metadata:
127
127
  bug_tracker_uri: https://github.com/rspec/rspec-support/issues
128
- changelog_uri: https://github.com/rspec/rspec-support/blob/v3.12.0/Changelog.md
128
+ changelog_uri: https://github.com/rspec/rspec-support/blob/v3.12.2/Changelog.md
129
129
  documentation_uri: https://rspec.info/documentation/
130
130
  mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
131
131
  source_code_uri: https://github.com/rspec/rspec-support
132
- post_install_message:
132
+ post_install_message:
133
133
  rdoc_options:
134
134
  - "--charset=UTF-8"
135
135
  require_paths:
@@ -145,8 +145,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  - !ruby/object:Gem::Version
146
146
  version: '0'
147
147
  requirements: []
148
- rubygems_version: 3.1.6
149
- signing_key:
148
+ rubygems_version: 3.4.10
149
+ signing_key:
150
150
  specification_version: 4
151
- summary: rspec-support-3.12.0
151
+ summary: rspec-support-3.12.2
152
152
  test_files: []
metadata.gz.sig CHANGED
Binary file