rspec-core 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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/Changelog.md +49 -2
  4. data/LICENSE.md +2 -2
  5. data/README.md +33 -44
  6. data/lib/rspec/core/bisect/example_minimizer.rb +3 -3
  7. data/lib/rspec/core/bisect/fork_runner.rb +0 -6
  8. data/lib/rspec/core/bisect/shell_command.rb +2 -0
  9. data/lib/rspec/core/bisect/shell_runner.rb +2 -25
  10. data/lib/rspec/core/bisect/utilities.rb +3 -7
  11. data/lib/rspec/core/configuration.rb +128 -330
  12. data/lib/rspec/core/configuration_options.rb +4 -16
  13. data/lib/rspec/core/drb.rb +0 -5
  14. data/lib/rspec/core/dsl.rb +3 -48
  15. data/lib/rspec/core/example.rb +5 -41
  16. data/lib/rspec/core/example_group.rb +36 -75
  17. data/lib/rspec/core/filter_manager.rb +2 -11
  18. data/lib/rspec/core/formatters/deprecation_formatter.rb +4 -4
  19. data/lib/rspec/core/formatters/exception_presenter.rb +30 -60
  20. data/lib/rspec/core/formatters/helpers.rb +1 -1
  21. data/lib/rspec/core/formatters/html_printer.rb +8 -7
  22. data/lib/rspec/core/formatters/html_snippet_extractor.rb +0 -4
  23. data/lib/rspec/core/formatters/profile_formatter.rb +2 -2
  24. data/lib/rspec/core/formatters/snippet_extractor.rb +3 -1
  25. data/lib/rspec/core/formatters/syntax_highlighter.rb +2 -0
  26. data/lib/rspec/core/formatters.rb +4 -8
  27. data/lib/rspec/core/hooks.rb +24 -45
  28. data/lib/rspec/core/memoized_helpers.rb +30 -120
  29. data/lib/rspec/core/metadata.rb +8 -216
  30. data/lib/rspec/core/metadata_filter.rb +15 -69
  31. data/lib/rspec/core/minitest_assertions_adapter.rb +2 -2
  32. data/lib/rspec/core/mocking_adapters/mocha.rb +2 -31
  33. data/lib/rspec/core/notifications.rb +4 -16
  34. data/lib/rspec/core/option_parser.rb +6 -14
  35. data/lib/rspec/core/ordering.rb +5 -6
  36. data/lib/rspec/core/output_wrapper.rb +2 -2
  37. data/lib/rspec/core/pending.rb +1 -9
  38. data/lib/rspec/core/project_initializer/spec/spec_helper.rb +14 -31
  39. data/lib/rspec/core/rake_task.rb +6 -7
  40. data/lib/rspec/core/shared_example_group.rb +7 -82
  41. data/lib/rspec/core/shell_escape.rb +2 -0
  42. data/lib/rspec/core/test_unit_assertions_adapter.rb +4 -17
  43. data/lib/rspec/core/version.rb +1 -1
  44. data/lib/rspec/core/world.rb +7 -22
  45. data/lib/rspec/core.rb +1 -22
  46. data.tar.gz.sig +0 -0
  47. metadata +24 -25
  48. metadata.gz.sig +0 -0
  49. data/lib/rspec/core/flat_map.rb +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 82dbc399705e303ef18399ee250bf5fb934ba581db0f46b474ba65197b2c6a50
4
- data.tar.gz: 56e628d1e04d1c79ceb6b4de672a0c3db07fc4c8b33c85695cd7eeb5d28e0cc6
3
+ metadata.gz: b56c09e1de4509725d998327b9063cb42f125f4974ca130c165605779751609c
4
+ data.tar.gz: 8bbf38e64d7d044f3c03194200c3a643ec18bbd26df5641461509f756cc612aa
5
5
  SHA512:
6
- metadata.gz: b7fac1133c1618a679a8ac4d1f3eb8b66344434687611405a4f6a7c5d61834e80782c60a0685d8c2a886d4c3a42d05db31f20c3616887610658d2e814a153bf0
7
- data.tar.gz: 75c5ceb3eedfdec5cb7ffc31d4078befc87684ff898e13173a25208132428a98472d8745c2272b58f7f3c64b9cd5056c8206752602dfc9d6a0f11164f51499d7
6
+ metadata.gz: bd6c5b7d64ed1f4e6a9f6d5cfdfda66460113f92056e1e53ee8fc801c8019e4443776e5b1e8fb9fb5416139023b320808b644ab23e1b611ad3c9fe6a06eeaed7
7
+ data.tar.gz: c20dd14add003858dcd535c74f200ef0ef969602a831a91cfd62be0896940eb97a89678db1f120c5476652f2245af3488db69d183cddb1a9008994ad964ff037
checksums.yaml.gz.sig CHANGED
Binary file
data/Changelog.md CHANGED
@@ -1,8 +1,55 @@
1
1
  ### Development
2
- [Full Changelog](https://github.com/rspec/rspec/compare/rspec-core-v3.13.6...3-13-maintenance)
2
+ [Full Changelog](https://github.com/rspec/rspec/compare/rspec-core-v3.13.6...main)
3
+
4
+ # 4.0.0.beta1 / 2026-02-18
5
+
6
+ Breaking Changes:
7
+
8
+ * Ruby < 3.0 is no longer supported. (Phil Pirozhkov, Jon Rowe, rspec/rspec-core#2787, rspec/rspec#258)
9
+ * Extract `should` syntax (including the non-monkey-patching one liner).
10
+ (Phil Pirozhkov, rspec/rspec-core#2803)
11
+ * Remove globally-exposed DSL (example and shared group methods
12
+ in the root scope and on Module). (Phil Pirozhkov, rspec/rspec-core#2803)
13
+ * Remove `run_all_when_everything_filtered` configuration option. (Phil Pirozhkov, rspec/rspec-core#2845)
14
+ * Change the default `shared_context_metadata_behavior` to `apply_to_host_groups`
15
+ and remove the configuration option. (Phil Pirozhkov, rspec/rspec-core#2834)
16
+ * Raise on unsupported hook scope usage. (Phil Pirozhkov, rspec/rspec-core#2849)
17
+ * Raise on usage of metadata on suite-level scopes. (Phil Pirozhkov, rspec/rspec-core#2849)
18
+ * Raise an error when `fail_fast` is configured with
19
+ an unsupported value. (Phil Pirozhkov, rspec/rspec-core#2849)
20
+ * Remove deprecated access to an example group's metadata through the example.
21
+ (Phil Pirozhkov, rspec/rspec-core#2851)
22
+ * Remove deprecated Hash-like behavior from example
23
+ execution result. (Phil Pirozhkov, rspec/rspec-core#2862)
24
+ * Skip setting the default pattern from Rake task. (Phil Pirozhkov, rspec/rspec-core#2868)
25
+ * Remove special `:if`/`:unless` filtering metadata. (Phil Pirozhkov, rspec/rspec-core#2870)
26
+ * Remove deprecated `color` configuration option and `--color` command line
27
+ option. (Phil Pirozhkov, rspec/rspec-core#2864)
28
+ * Remove `it_should_behave_like` nested shared group method and
29
+ `alias_it_should_behave_like_to` configuration option. (Phil Pirozhkov, rspec/rspec-core#2864)
30
+ * Remove deprecated `treat_symbols_as_metadata_keys_with_true_values` configuration
31
+ option. (Phil Pirozhkov, rspec/rspec-core#2864)
32
+ * Remove support for Mocha version < 1.0. (Phil Pirozhkov, rspec/rspec-core#2864)
33
+ * Remove deprecated `PendingExampleFixedNotification` and
34
+ `PendingExampleFailedAsExpectedNotification` classes. (Phil Pirozhkov, rspec/rspec-core#2864)
35
+ * Remove deprecated `rerun_argument` example method. (Phil Pirozhkov, rspec/rspec-core#2864)
36
+ * Raise on attempt to use a legacy formatter without `rspec-legacy_formatters`.
37
+ (Phil Pirozhkov, rspec/rspec-core#2864)
38
+ * Unify multi-condition filtering to use "all" semantic. (Phil Pirozhkov, rspec/rspec-core#2874)
39
+ * Change the default order to random. (Santiago Bartesaghi, rspec/rspec-core#2929)
40
+ * Default warning level is now `:deprecations_only`. (Jon Rowe, rspec/rspec#161)
41
+ * Raise an error when a block is passed to `include_examples`. (Phil Pirozhkov, rspec/rspec#259)
42
+
43
+ Enhancements:
44
+
45
+ * Add config option (`RSpec::Core::Configuration#force_line_number_for_spec_rerun`) to
46
+ allways print a line number rather than an example id when the line number is ambiguous.
47
+ (Baden Ashford, rspec/rspec-core#3085)
48
+ * Expand `RSpec::Core::Configuration#warnings=` to take `:all`, `:deprecations_only` and `:none`
49
+ options. (Jean Boussier, rspec/rspec#161)
3
50
 
4
51
  ### 3.13.6 / 2025-10-19
5
- [Full Changelog](http://github.com/rspec/rspec/compare/rspec-core-v3.13.4...rspec-core-v3.13.5)
52
+ [Full Changelog](http://github.com/rspec/rspec/compare/rspec-core-v3.13.5...rspec-core-v3.13.6)
6
53
 
7
54
  Bug Fixes:
8
55
 
data/LICENSE.md CHANGED
@@ -1,8 +1,8 @@
1
1
  The MIT License (MIT)
2
2
  =====================
3
3
 
4
- * Copyright © 2012 Chad Humphries, David Chelimsky, Myron Marston
5
- * Copyright © 2009 Chad Humphries, David Chelimsky
4
+ * Copyright © 2013 David Chelimsky, Myron Marston, Jon Rowe, Sam Phippen, Xavier Shay, Bradley Schaefer
5
+ * Copyright © 2012 David Chelimsky, Myron Marston
6
6
  * Copyright © 2006 David Chelimsky, The RSpec Development Team
7
7
  * Copyright © 2005 Steven Baker
8
8
 
data/README.md CHANGED
@@ -1,23 +1,11 @@
1
- # rspec-core [![Build Status](https://github.com/rspec/rspec-core/workflows/RSpec%20CI/badge.svg)](https://github.com/rspec/rspec-core/actions) [![Code Climate](https://codeclimate.com/github/rspec/rspec-core.svg)](https://codeclimate.com/github/rspec/rspec-core)
1
+ # RSpec::Core
2
2
 
3
- rspec-core provides the structure for writing executable examples of how your
4
- code should behave, and an `rspec` command with tools to constrain which
5
- examples get run and tailor the output.
3
+ This is the detailed readme for `rspec-core`, see also:
6
4
 
7
- ## Install
8
-
9
- gem install rspec # for rspec-core, rspec-expectations, rspec-mocks
10
- gem install rspec-core # for rspec-core only
11
- rspec --help
12
-
13
- Want to run against the `main` branch? You'll need to include the dependent
14
- RSpec repos as well. Add the following to your `Gemfile`:
15
-
16
- ```ruby
17
- %w[rspec rspec-core rspec-expectations rspec-mocks rspec-support].each do |lib|
18
- gem lib, :git => "https://github.com/rspec/#{lib}.git", :branch => 'main'
19
- end
20
- ```
5
+ * [The combined readme](../README.md)
6
+ * [rspec-expectations](../rspec-expectations/README.md)
7
+ * [rspec-mocks](../rspec-mocks/README.md)
8
+ * [rspec-support](../rspec-support/README.md)
21
9
 
22
10
  ## Basic Structure
23
11
 
@@ -78,10 +66,8 @@ the inheritance semantics you'd want for free.
78
66
  ## Aliases
79
67
 
80
68
  You can declare example groups using either `describe` or `context`.
81
- For a top level example group, `describe` and `context` are available
82
- off of `RSpec`. For backwards compatibility, they are also available
83
- off of the `main` object and `Module` unless you disable monkey
84
- patching.
69
+ For a top-level example group, `describe` and `context` are available
70
+ off of `RSpec`.
85
71
 
86
72
  You can declare examples within a group using any of `it`, `specify`, or
87
73
  `example`.
@@ -89,7 +75,7 @@ You can declare examples within a group using any of `it`, `specify`, or
89
75
  ## Shared Examples and Contexts
90
76
 
91
77
  Declare a shared example group using `shared_examples`, and then include it
92
- in any group using `include_examples`.
78
+ in any group using `it_behaves_like` or `include_examples`.
93
79
 
94
80
  ```ruby
95
81
  RSpec.shared_examples "collections" do |collection_class|
@@ -98,15 +84,39 @@ RSpec.shared_examples "collections" do |collection_class|
98
84
  end
99
85
  end
100
86
 
87
+ RSpec.shared_examples "implements #empty?" do
88
+ it "returns true when there are no members" do
89
+ expect(empty_target).to be_empty
90
+ end
91
+
92
+ it "returns false when there are members" do
93
+ expect(non_empty_target).to_not be_empty
94
+ end
95
+ end
96
+
101
97
  RSpec.describe Array do
102
98
  include_examples "collections", Array
99
+
100
+ it_behaves_like "implements #empty?" do
101
+ let(:empty_target) { Array.new }
102
+ let(:non_empty_target) { [:key] }
103
+ end
103
104
  end
104
105
 
105
106
  RSpec.describe Hash do
106
107
  include_examples "collections", Hash
108
+
109
+ it_behaves_like "implements #empty?" do
110
+ let(:empty_target) { Hash.new }
111
+ let(:non_empty_target) { {key: :value} }
112
+ end
107
113
  end
108
114
  ```
109
115
 
116
+ Note that `include_examples` directly includes examples into the current context, whilst
117
+ `it_behaves_like` wraps the examples in a new context which allows you to pass a block
118
+ to customise things like `let` or `subject` without using local variables passed in.
119
+
110
120
  Nearly anything that can be declared within an example group can be declared
111
121
  within a shared example group. This includes `before`, `after`, and `around`
112
122
  hooks, `let` declarations, and nested groups/contexts.
@@ -366,24 +376,3 @@ Calculator
366
376
  Finished in 0.000379 seconds
367
377
  1 example, 0 failures
368
378
  ```
369
-
370
- ## Contributing
371
-
372
- Once you've set up the environment, you'll need to cd into the working
373
- directory of whichever repo you want to work in. From there you can run the
374
- specs and cucumber features, and make patches.
375
-
376
- NOTE: You do not need to use rspec-dev to work on a specific RSpec repo. You
377
- can treat each RSpec repo as an independent project.
378
-
379
- * [Build details](BUILD_DETAIL.md)
380
- * [Code of Conduct](CODE_OF_CONDUCT.md)
381
- * [Detailed contributing guide](CONTRIBUTING.md)
382
- * [Development setup guide](DEVELOPMENT.md)
383
-
384
- ## Also see
385
-
386
- * [https://github.com/rspec/rspec](https://github.com/rspec/rspec)
387
- * [https://github.com/rspec/rspec-expectations](https://github.com/rspec/rspec-expectations)
388
- * [https://github.com/rspec/rspec-mocks](https://github.com/rspec/rspec-mocks)
389
- * [https://github.com/rspec/rspec-rails](https://github.com/rspec/rspec-rails)
@@ -123,7 +123,7 @@ module RSpec
123
123
 
124
124
  if @failed_example_ids.empty?
125
125
  raise BisectFailedError, "\n\nNo failures found. Bisect only works " \
126
- "in the presence of one or more failing examples."
126
+ "in the presence of one or more failing examples."
127
127
  else
128
128
  notify(:bisect_original_run_complete, :failed_example_ids => failed_example_ids,
129
129
  :non_failing_example_ids => non_failing_example_ids,
@@ -160,8 +160,8 @@ module RSpec
160
160
  return if expected_order == results.all_example_ids
161
161
 
162
162
  raise BisectFailedError, "\n\nThe example ordering is inconsistent. " \
163
- "`--bisect` relies upon consistent ordering (e.g. by passing " \
164
- "`--seed` if you're using random ordering) to work properly."
163
+ "`--bisect` relies upon consistent ordering (e.g. by passing " \
164
+ "`--seed` if you're using random ordering) to work properly."
165
165
  end
166
166
 
167
167
  def notify(*args)
@@ -112,12 +112,6 @@ module RSpec
112
112
  c.load_spec_files
113
113
  end
114
114
 
115
- # `announce_filters` has the side effect of implementing the logic
116
- # that honors `config.run_all_when_everything_filtered` so we need
117
- # to call it here. When we remove `run_all_when_everything_filtered`
118
- # (slated for RSpec 4), we can remove this call to `announce_filters`.
119
- @runner.world.announce_filters
120
-
121
115
  @runner.run_specs(@runner.world.ordered_example_groups)
122
116
  latest_run_results = formatter.results
123
117
 
@@ -1,4 +1,5 @@
1
1
  RSpec::Support.require_rspec_core "shell_escape"
2
+ RSpec::Support.require_rspec_support 'ruby_features'
2
3
  require 'shellwords'
3
4
 
4
5
  module RSpec
@@ -63,6 +64,7 @@ module RSpec
63
64
  private
64
65
 
65
66
  include RSpec::Core::ShellEscape
67
+
66
68
  # On JRuby, Open3.popen3 does not handle shellescaped args properly:
67
69
  # https://github.com/jruby/jruby/issues/2767
68
70
  if RSpec::Support::Ruby.jruby?
@@ -41,31 +41,8 @@ module RSpec
41
41
  end
42
42
  end
43
43
 
44
- # `Open3.capture2e` does not work on JRuby:
45
- # https://github.com/jruby/jruby/issues/2766
46
- if Open3.respond_to?(:capture2e) && !RSpec::Support::Ruby.jruby?
47
- def run_command(cmd)
48
- Open3.capture2e(@shell_command.bisect_environment_hash, cmd).first
49
- end
50
- else # for 1.8.7
51
- # :nocov:
52
- def run_command(cmd)
53
- out = err = nil
54
-
55
- original_spec_opts = ENV['SPEC_OPTS']
56
- ENV['SPEC_OPTS'] = @shell_command.spec_opts_without_bisect
57
-
58
- Open3.popen3(cmd) do |_, stdout, stderr|
59
- # Reading the streams blocks until the process is complete
60
- out = stdout.read
61
- err = stderr.read
62
- end
63
-
64
- "Stdout:\n#{out}\n\nStderr:\n#{err}"
65
- ensure
66
- ENV['SPEC_OPTS'] = original_spec_opts
67
- end
68
- # :nocov:
44
+ def run_command(cmd)
45
+ Open3.capture2e(@shell_command.bisect_environment_hash, cmd).first
69
46
  end
70
47
  end
71
48
  end
@@ -34,17 +34,13 @@ module RSpec
34
34
  # parent.
35
35
  # @private
36
36
  class Channel
37
- if String.method_defined?(:encoding)
38
- MARSHAL_DUMP_ENCODING = Marshal.dump("").encoding
39
- end
37
+ MARSHAL_DUMP_ENCODING = Marshal.dump("").encoding
40
38
 
41
39
  def initialize
42
40
  @read_io, @write_io = IO.pipe
43
41
 
44
- if defined?(MARSHAL_DUMP_ENCODING) && IO.method_defined?(:set_encoding)
45
- # Ensure the pipe can send any content produced by Marshal.dump
46
- @write_io.set_encoding MARSHAL_DUMP_ENCODING
47
- end
42
+ # Ensure the pipe can send any content produced by Marshal.dump
43
+ @write_io.set_encoding MARSHAL_DUMP_ENCODING
48
44
  end
49
45
 
50
46
  def send(message)