Compare commits

...
Sign in to create a new pull request.

120 commits

Author SHA1 Message Date
Mamoru TASAKA
18f1a22546 Backport upstream patch to skip mock for Kernel#inspect on ruby4_0 2025-12-02 16:42:08 +09:00
Mamoru TASAKA
84c1aaf566 kill bootstrap 2025-11-24 10:26:50 +09:00
Mamoru TASAKA
a36833c28c 3.13.7 2025-11-24 10:18:24 +09:00
Mamoru TASAKA
9630dad5df 3.13.6 2025-10-17 16:09:32 +09:00
Fedora Release Engineering
ea7c65f947 Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-25 12:45:43 +00:00
Mamoru TASAKA
e8c6bb2889 3.13.5 2025-05-29 17:33:05 +09:00
Mamoru TASAKA
c90968f649 3.13.4 2025-05-15 14:50:56 +09:00
Fedora Release Engineering
f61b7f5c69 Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-18 23:57:55 +00:00
Mamoru TASAKA
c8bf8300ed Coordinate with rspec-support change wrt ruby34 hash inspect support 2024-12-29 11:06:39 +09:00
Mamoru TASAKA
1c042ffadc Backport upstream patch to support ruby34 formatting 2024-11-06 17:09:00 +09:00
Mamoru TASAKA
3665cf0e86 3.13.2 2024-10-03 19:33:47 +09:00
Fedora Release Engineering
e5b0f4df0b Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild 2024-07-19 19:55:06 +00:00
Mamoru TASAKA
c7006f9137 3.13.1 2024-05-09 17:23:35 +09:00
Mamoru TASAKA
898969673b bump release and build 2024-04-18 20:21:50 +09:00
Jun Aruga
ccc4fd302a Remove unused thread_order build dependency. 2024-04-17 18:19:07 +02:00
Mamoru TASAKA
284f768d3d enable test again 2024-02-09 15:46:11 +09:00
Mamoru TASAKA
a818ea3193 3.13.0 2024-02-09 15:22:52 +09:00
Fedora Release Engineering
c577550897 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-26 17:26:50 +00:00
Fedora Release Engineering
cf6a009f48 Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-21 18:20:39 +00:00
Mamoru TASAKA
0ea2b628db 3.12.6 2023-07-16 16:14:37 +09:00
Yaakov Selkowitz
2d95f7b052 Fix RHEL build
The aruba dependency is already avoided in BuildRequires, but these
files require aruba.  They cannot be removed though, as the tests
fail if they are absent.
2023-06-02 15:46:05 -04:00
Mamoru TASAKA
73e82a7350 3.12.5 2023-04-01 16:34:03 +09:00
Mamoru TASAKA
782f500451 3.12.4 2023-03-14 16:06:16 +09:00
Mamoru TASAKA
a21d562ba0 rename release macro to make rpmdev-bumprelease work 2023-03-13 10:36:40 +09:00
Mamoru TASAKA
60348c9329 Disable unwanted dependencies in RHEL builds 2023-03-09 16:28:46 +09:00
Yaakov Selkowitz
1cbc29fbad Fix ELN build
The patches do not apply against the current version, but regardless,
the condition is incorrect for the stated intention.  Also, remove
test dependencies that are unwanted in RHEL/ELN.
2023-03-08 17:05:44 -05:00
Mamoru TASAKA
b527e5d20d 3.12.3 2023-02-16 18:09:39 +09:00
Fedora Release Engineering
7643aa8e8d Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-20 21:04:53 +00:00
Mamoru TASAKA
48056bf83c Backport upstream reviewing patch for ruby32 ruby2_keywords treatment change 2022-12-02 11:27:56 +09:00
Mamoru TASAKA
2ed99dbfd4 On Fedora 37, remove "Display keyword hashes" feature for now
(On Fedora 38, this is effective)
2022-11-04 01:41:53 +09:00
Mamoru TASAKA
ee6f2a42cb enable test again 2022-10-27 16:03:34 +09:00
Mamoru TASAKA
7b31c28708 3.12.0 2022-10-27 15:40:18 +09:00
Mamoru TASAKA
ae84f53d6d 3.11.2 2022-10-26 17:06:42 +09:00
Mamoru TASAKA
2d7218ef19 Backport upstream patch for ruby32 wrt method reference changes 2022-10-03 22:37:23 +09:00
Fedora Release Engineering
e0d9afcb63 Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-07-23 02:13:27 +00:00
Mamoru TASAKA
af762d9f91 fix date 2022-04-07 15:26:46 +09:00
Mamoru TASAKA
a51ae3a4c2 3.11.1 2022-04-07 15:25:05 +09:00
Mamoru TASAKA
262bfe1247 kill bootstrap 2022-02-10 13:24:19 +09:00
Mamoru TASAKA
afc127b0f7 3.11.0 2022-02-10 12:32:53 +09:00
Mamoru TASAKA
21d4900b2e 3.10.3 2022-01-30 12:17:03 +09:00
Mamoru TASAKA
c4fd1e2c04 simplify gitignore 2022-01-30 12:07:21 +09:00
Mamoru TASAKA
7b0da07d43 BR: rubygem(rake) for check 2022-01-30 12:01:05 +09:00
Mamoru TASAKA
f502111f26 Execute cucumber test 2022-01-20 16:25:38 +09:00
Fedora Release Engineering
58604d2c08 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-23 12:37:55 +00:00
Mamoru TASAKA
4b7a4f3798 3.10.2 2021-02-01 15:47:51 +09:00
Fedora Release Engineering
c7118356f6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-01-27 16:26:21 +00:00
Mamoru TASAKA
5ef010f374 3.10.1 2020-12-29 14:57:00 +09:00
Mamoru TASAKA
a6d77eca9a Enable tests again 2020-12-11 15:23:03 +09:00
Mamoru TASAKA
19875edad2 3.10.0
Once disable test for bootstrap
2020-12-11 14:43:51 +09:00
Fedora Release Engineering
985e3b5a35 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-07-29 07:00:36 +00:00
Fedora Release Engineering
85e0472e25 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-01-30 19:18:03 +00:00
Mamoru TASAKA
9fb0caf4e9 3.9.1 2020-01-02 22:11:02 +09:00
Mamoru TASAKA
1d598b1b65 really bump 2019-12-10 16:16:36 +09:00
Mamoru TASAKA
aad03aa25d enable tests again, really 2019-12-10 16:15:42 +09:00
Mamoru TASAKA
4d70a744d5 Enable tests again 2019-12-10 15:52:57 +09:00
Mamoru TASAKA
c651525d92 3.9.0
Once disable test for bootstrap
2019-12-10 14:59:34 +09:00
Fedora Release Engineering
2a6c47bea1 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-07-26 20:03:18 +00:00
Mamoru TASAKA
9c4d1ea014 3.8.1 2019-06-21 16:07:53 +09:00
Fedora Release Engineering
1eb039b42a - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-02-02 12:57:26 +00:00
Igor Gnatenko
58dd4daaa2 Remove obsolete Group tag
References: https://fedoraproject.org/wiki/Changes/Remove_Group_Tag
2019-01-28 20:24:47 +01:00
Mamoru TASAKA
26005d5035 Enable tests again 2018-12-13 14:52:40 +09:00
Mamoru TASAKA
46385cd41d oops.. 2018-12-13 14:21:45 +09:00
Mamoru TASAKA
f67b7cbdf3 3.8.0
Once disable test for bootstrap
2018-12-13 14:07:50 +09:00
Zbigniew Jędrzejewski-Szmek
c487d4c3bf Use C.UTF-8 locale 2018-11-19 00:27:46 +01:00
Fedora Release Engineering
3727183492 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-07-14 04:43:42 +00:00
Mamoru TASAKA
e5273eee8a Backport patch to fix test failure with ruby 2.5 2018-02-14 16:06:42 +09:00
Mamoru TASAKA
9efec799ef ruby 2.5 drops -rubygems usage 2018-02-13 14:19:21 +09:00
Fedora Release Engineering
f3091dfcb0 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-02-09 14:48:05 +00:00
Mamoru TASAKA
b39b77edc2 Enable tests again 2017-11-13 15:59:18 +09:00
Mamoru TASAKA
647fb683f8 3.7.0
Once disable tests
2017-11-13 15:49:08 +09:00
Fedora Release Engineering
7f6dca966a - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild 2017-07-27 17:44:49 +00:00
Mamoru TASAKA
87430d3b40 Enable tests again 2017-05-06 23:40:35 +09:00
Mamoru TASAKA
e7bf6e12e6 add full source 2017-05-06 22:26:27 +09:00
Mamoru TASAKA
583412e47d remove patch 2017-05-06 22:18:21 +09:00
Mamoru TASAKA
3ec1cc766d 3.6.0
Once disable tests
2017-05-06 22:15:41 +09:00
Fedora Release Engineering
4b99dec2b6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild 2017-02-11 12:44:57 +00:00
Vít Ondruch
d0671fa797 Fix Ruby 2.4 compatibility. 2017-01-17 13:24:11 +01:00
Mamoru TASAKA
26b4a3f5db Enable tests again 2016-07-24 01:13:42 +09:00
Mamoru TASAKA
81fdb43be4 3.5.0
- Once disable tests
2016-07-24 00:47:22 +09:00
Fedora Release Engineering
10528819e6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild 2016-02-04 23:14:34 +00:00
Mamoru TASAKA
d314fe5433 3.4.1 2016-01-14 14:05:41 +09:00
Mamoru TASAKA
a614195d0a Enable tests again 2015-12-08 17:24:21 +09:00
Mamoru TASAKA
f0b57109d4 3.4.0
- Once disable tests
2015-12-08 16:21:51 +09:00
Mamoru TASAKA
5ea97bd517 Enable thread_order dependent tests 2015-08-12 15:59:01 +09:00
Mamoru TASAKA
7d27b8348a BR: git 2015-08-02 21:16:29 +09:00
Mamoru TASAKA
e8948c8fdb Enable tests again 2015-08-02 20:41:58 +09:00
Mamoru TASAKA
8badd25998 3.3.2
- Once disable tests
2015-08-02 16:17:53 +09:00
Dennis Gilmore
c7d440560e - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild 2015-06-18 23:49:00 +00:00
Mamoru TASAKA
dfdafa157e 3.2.1 2015-02-25 15:39:17 +09:00
John
7958967f35 Enable tests again 2015-02-09 11:21:24 +09:00
John
80f388720b 3.2.0
- Once disable tests
2015-02-09 09:46:03 +09:00
Mamoru TASAKA
d05df963c6 Enable tests 2014-11-10 17:43:45 +09:00
Mamoru TASAKA
85da804b4a add missing script 2014-11-10 16:44:04 +09:00
Mamoru TASAKA
086dd2faad 3.1.3
- Once disable tests
2014-11-10 16:37:38 +09:00
Dennis Gilmore
c5afe6d9ee - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild 2014-06-08 00:15:53 -05:00
Mamoru TASAKA
3229be30f0 2.14.6 2014-02-27 16:00:22 +09:00
Mamoru TASAKA
bdd9be346b 2.14.5 2014-02-04 13:04:25 +09:00
Mamoru TASAKA
9029b191a7 2.14.4 2013-10-24 17:34:23 +09:00
Mamoru TASAKA
0a45ebf637 Enable test suite again 2013-08-16 01:03:39 +09:00
Mamoru TASAKA
84ebd544d1 2.14.3 2013-08-16 00:44:11 +09:00
Dennis Gilmore
a1825c335b - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild 2013-08-04 09:56:58 -05:00
TASAKA Mamoru
a1f45443ff 2.13.1 2013-04-12 16:36:46 +09:00
TASAKA Mamoru
0a8c021a1c Enable test suite again 2013-03-28 17:18:10 +09:00
TASAKA Mamoru
e8e1f167d9 2.13.0 2013-03-28 16:31:01 +09:00
Vít Ondruch
95b8578f4f Rebuild for https://fedoraproject.org/wiki/Features/Ruby_2.0.0 2013-02-24 12:50:21 +01:00
Vít Ondruch
2277cdf426 Rebuild for https://fedoraproject.org/wiki/Features/Ruby_2.0.0
Bootstrap round.
2013-02-22 19:13:54 +01:00
TASAKA Mamoru
d2c79226ae 2.12.2 2013-02-04 12:28:09 +09:00
Mamoru Tasaka
1145db5ca8 Enable test suite again 2013-01-02 15:26:50 +09:00
Mamoru Tasaka
38264f5fa2 2.12.1 2013-01-02 14:56:21 +09:00
TASAKA Mamoru
00ace0a621 2.11.3 2012-10-11 18:12:31 +09:00
Dennis Gilmore
59a3ea262f - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild 2012-07-21 13:26:55 -05:00
Mamoru Tasaka
68ff1bebea add br 2012-01-22 06:38:18 +09:00
Mamoru Tasaka
88f1a70f40 2.8.0 2012-01-22 06:18:52 +09:00
Dennis Gilmore
1a5f99a00f - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild 2012-01-13 21:23:10 -06:00
Mamoru Tasaka
764f84fcf2 2.6.0 2011-05-16 01:43:43 +09:00
Mamoru Tasaka
0de2791f60 2.6.0 rc6 2011-05-11 06:47:09 +09:00
Mamoru Tasaka
79a0c944de And enable check on rawhide 2011-05-03 16:45:41 +09:00
Mamoru Tasaka
ef06d63f01 2.6.0 rc4 2011-05-03 14:02:28 +09:00
Mamoru Tasaka
e06815bd81 And enable check on rawhide 2011-02-26 03:33:07 +09:00
Mamoru Tasaka
fd3177d18a Initial import 2011-02-26 03:03:25 +09:00
7 changed files with 1131 additions and 0 deletions

2
.gitignore vendored
View file

@ -0,0 +1,2 @@
/rspec-mocks-*.gem
/rubygem-rspec-mocks-*-full.tar.gz

View file

@ -0,0 +1,429 @@
From f8b49348d02d0220e20391665f7418f9212dac02 Mon Sep 17 00:00:00 2001
From: Jon Rowe <hello@jonrowe.co.uk>
Date: Fri, 18 Oct 2024 21:39:26 +0100
Subject: [PATCH] Relax specs for Ruby 3.4 hash formatting
---
.../matching_arguments.feature | 6 +-
.../step_definitions/additional_cli_steps.rb | 7 +-
spec/rspec/mocks/argument_matchers_spec.rb | 14 ++--
spec/rspec/mocks/diffing_spec.rb | 84 ++++++++++++-------
spec/rspec/mocks/double_spec.rb | 9 +-
.../mocks/hash_excluding_matcher_spec.rb | 9 +-
.../mocks/hash_including_matcher_spec.rb | 9 +-
spec/rspec/mocks/matchers/receive_spec.rb | 26 ++++--
.../expected_arg_verification_spec.rb | 11 ++-
9 files changed, 124 insertions(+), 51 deletions(-)
diff --git a/features/setting_constraints/matching_arguments.feature b/features/setting_constraints/matching_arguments.feature
index caea74248..cad5cea4c 100644
--- a/features/setting_constraints/matching_arguments.feature
+++ b/features/setting_constraints/matching_arguments.feature
@@ -73,7 +73,7 @@ Feature: Matching arguments
end
"""
When I run `rspec keyword_example_spec.rb`
- Then it should fail with the following output:
+ Then it should fail with the following output, ignoring hash syntax:
| 2 examples, 1 failure |
| |
| Failure/Error: dbl.foo(bar: "incorrect") |
@@ -100,7 +100,7 @@ Feature: Matching arguments
end
"""
When I run `rspec keyword_example_spec.rb`
- Then it should fail with the following output:
+ Then it should fail with the following output, ignoring hash syntax:
| 1 example, 1 failure |
| |
| Failure/Error: dbl.foo({bar: "also incorrect"}) |
@@ -156,7 +156,7 @@ Feature: Matching arguments
end
"""
When I run `rspec rspec_satisfy_spec.rb`
- Then it should fail with the following output:
+ Then it should fail with the following output, ignoring hash syntax:
| 2 examples, 1 failure |
| |
| Failure/Error: dbl.foo({ :a => { :b => { :c => 3 } } }) |
diff --git a/features/step_definitions/additional_cli_steps.rb b/features/step_definitions/additional_cli_steps.rb
index 77f8c0f30..acf1117e0 100644
--- a/features/step_definitions/additional_cli_steps.rb
+++ b/features/step_definitions/additional_cli_steps.rb
@@ -22,8 +22,13 @@
diffable
end
-Then /^it should fail with the following output:$/ do |table|
+Then /^it should fail with the following output(, ignoring hash syntax)?:$/ do |ignore_hash_syntax, table|
step %q(the exit status should be 1)
lines = table.raw.flatten.reject(&:empty?)
+
+ if ignore_hash_syntax && RUBY_VERSION.to_f > 3.3
+ lines = lines.map { |line| line.gsub(/([^\s])=>/, '\1 => ') }
+ end
+
expect(all_output).to match_table(lines)
end
diff --git a/spec/rspec/mocks/argument_matchers_spec.rb b/spec/rspec/mocks/argument_matchers_spec.rb
index eb101a04c..8f31d1786 100644
--- a/spec/rspec/mocks/argument_matchers_spec.rb
+++ b/spec/rspec/mocks/argument_matchers_spec.rb
@@ -256,7 +256,7 @@ module Mocks
expect(a_double).to receive(:random_call).with(hash_including(:a => 1))
expect {
a_double.random_call(:a => 2)
- }.to fail_including "expected: (hash_including(:a=>1))"
+ }.to fail_including "expected: (hash_including(#{hash_syntax(:a => 1)}))"
end
end
@@ -270,7 +270,7 @@ module Mocks
expect(a_double).to receive(:random_call).with(hash_excluding(:a => 1))
expect {
a_double.random_call(:a => 1)
- }.to fail_including "expected: (hash_not_including(:a=>1))"
+ }.to fail_including "expected: (hash_not_including(#{hash_syntax(:a => 1)}))"
end
end
@@ -431,7 +431,7 @@ def ==(other)
expect(a_double).to receive(:random_call).with(:a => "a", :b => "b")
expect do
a_double.random_call(opts)
- end.to fail_with(/expected: \(\{(:a=>\"a\", :b=>\"b\"|:b=>\"b\", :a=>\"a\")\}\)/)
+ end.to fail_with(/expected: \(\{(:a\s*=>\s*\"a\", :b\s*=>\s*\"b\"|:b\s*=>\s*\"b\", :a\s*=>\s*\"a\")\}\)/)
end
else
it "matches against a hash submitted as a positional argument and received as keyword arguments in Ruby 2.7 or before" do
@@ -445,14 +445,14 @@ def ==(other)
expect(a_double).to receive(:random_call).with(:a => "b", :c => "d")
expect do
a_double.random_call(:a => "b", :c => "e")
- end.to fail_with(/expected: \(\{(:a=>\"b\", :c=>\"d\"|:c=>\"d\", :a=>\"b\")\}\)/)
+ end.to fail_with(/expected: \(\{(:a\s*=>\s*\"b\", :c\s*=>\s*\"d\"|:c\s*=>\s*\"d\", :a\s*=>\s*\"b\")\}\)/)
end
it "fails for a hash w/ wrong keys", :reset => true do
expect(a_double).to receive(:random_call).with(:a => "b", :c => "d")
expect do
a_double.random_call("a" => "b", "c" => "d")
- end.to fail_with(/expected: \(\{(:a=>\"b\", :c=>\"d\"|:c=>\"d\", :a=>\"b\")\}\)/)
+ end.to fail_with(/expected: \(\{(:a\s*=>\s*\"b\", :c\s*=>\s*\"d\"|:c\s*=>\s*\"d\", :a\s*=>\s*\"b\")\}\)/)
end
it "matches a class against itself" do
@@ -502,6 +502,10 @@ def ==(other)
expect { a_double.msg 3 }.to fail_including "expected: (my_thing)"
end
end
+
+ def hash_syntax(hash)
+ hash.inspect.gsub(/\{(.*)\}/, '\1')
+ end
end
end
end
diff --git a/spec/rspec/mocks/diffing_spec.rb b/spec/rspec/mocks/diffing_spec.rb
index e40fa55b6..8be6510da 100644
--- a/spec/rspec/mocks/diffing_spec.rb
+++ b/spec/rspec/mocks/diffing_spec.rb
@@ -100,15 +100,18 @@
if RSpec::Support::RubyFeatures.distincts_kw_args_from_positional_hash?
eval <<-'RUBY', nil, __FILE__, __LINE__ + 1
it "prints a diff when keyword argument were expected but got an option hash (using splat)" do
+ message =
+ "#<Double \"double\"> received :foo with unexpected arguments\n" \
+ " expected: ({:baz=>:quz, :foo=>:bar}) (keyword arguments)\n" \
+ " got: ({:baz=>:quz, :foo=>:bar}) (options hash)"
+
+ message = message.gsub('=>', ' => ') if RUBY_VERSION.to_f > 3.3
+
with_unfulfilled_double do |d|
expect(d).to receive(:foo).with(**expected_hash)
expect {
d.foo(expected_hash)
- }.to fail_with(
- "#<Double \"double\"> received :foo with unexpected arguments\n" \
- " expected: ({:baz=>:quz, :foo=>:bar}) (keyword arguments)\n" \
- " got: ({:baz=>:quz, :foo=>:bar}) (options hash)"
- )
+ }.to fail_with(message)
end
end
RUBY
@@ -117,14 +120,18 @@
it "prints a diff when keyword argument were expected but got an option hash (literal)" do
with_unfulfilled_double do |d|
expect(d).to receive(:foo).with(:positional, keyword: 1)
- expect {
- options = { keyword: 1 }
- d.foo(:positional, options)
- }.to fail_with(
+
+ message =
"#<Double \"double\"> received :foo with unexpected arguments\n" \
" expected: (:positional, {:keyword=>1}) (keyword arguments)\n" \
" got: (:positional, {:keyword=>1}) (options hash)"
- )
+
+ message = message.gsub('=>',' => ') if RUBY_VERSION.to_f > 3.3
+
+ expect {
+ options = { keyword: 1 }
+ d.foo(:positional, options)
+ }.to fail_with(message)
end
end
RUBY
@@ -139,10 +146,7 @@
expect(d).to receive(:foo).with(expected_input, one: 1)
- expect {
- options = { one: 1 }
- d.foo(actual_input, options)
- }.to fail_with(
+ message =
"#<Double \"double\"> received :foo with unexpected arguments\n" \
" expected: (#{expected_input.inspect}, {:one=>1}) (keyword arguments)\n" \
" got: (#{actual_input.inspect}, {:one=>1}) (options hash)\n" \
@@ -150,7 +154,13 @@
"@@ -1 +1 @@\n" \
"-[#{expected_input.inspect}, {:one=>1}]\n" \
"+[#{actual_input.inspect}, {:one=>1}]\n"
- )
+
+ message = message.gsub('=>',' => ') if RUBY_VERSION.to_f > 3.3
+
+ expect {
+ options = { one: 1 }
+ d.foo(actual_input, options)
+ }.to fail_with(message)
end
end
RUBY
@@ -172,28 +182,34 @@
if RSpec::Support::RubyFeatures.distincts_kw_args_from_positional_hash?
eval <<-'RUBY', nil, __FILE__, __LINE__ + 1
it "prints a diff when keyword argument were expected but got an option hash (using splat)" do
- expect(d).to receive(:foo).with(:positional, **expected_hash)
- expect {
- d.foo(:positional, expected_hash)
- }.to fail_with(
+ message =
"#{d.inspect} received :foo with unexpected arguments\n" \
" expected: (:positional, {:baz=>:quz, :foo=>:bar}) (keyword arguments)\n" \
" got: (:positional, {:baz=>:quz, :foo=>:bar}) (options hash)"
- )
+
+ message.gsub!('=>',' => ') if RUBY_VERSION.to_f > 3.3
+
+ expect(d).to receive(:foo).with(:positional, **expected_hash)
+ expect {
+ d.foo(:positional, expected_hash)
+ }.to fail_with(message)
end
RUBY
eval <<-'RUBY', nil, __FILE__, __LINE__ + 1
it "prints a diff when keyword argument were expected but got an option hash (literal)" do
+ message =
+ "#{d.inspect} received :foo with unexpected arguments\n" \
+ " expected: (:positional, {:keyword=>1}) (keyword arguments)\n" \
+ " got: (:positional, {:keyword=>1}) (options hash)"
+
+ message.gsub!('=>',' => ') if RUBY_VERSION.to_f > 3.3
+
expect(d).to receive(:foo).with(:positional, keyword: 1)
expect {
options = { keyword: 1 }
d.foo(:positional, options)
- }.to fail_with(
- "#{d.inspect} received :foo with unexpected arguments\n" \
- " expected: (:positional, {:keyword=>1}) (keyword arguments)\n" \
- " got: (:positional, {:keyword=>1}) (options hash)"
- )
+ }.to fail_with(message)
end
RUBY
@@ -206,10 +222,7 @@
expect(d).to receive(:foo).with(expected_input, one: 1)
- expect {
- options = { one: 1 }
- d.foo(actual_input, options)
- }.to fail_with(
+ message =
"#{d.inspect} received :foo with unexpected arguments\n" \
" expected: (#{expected_input.inspect}, {:one=>1}) (keyword arguments)\n" \
" got: (#{actual_input.inspect}, {:one=>1}) (options hash)\n" \
@@ -217,7 +230,13 @@
"@@ -1 +1 @@\n" \
"-[#{expected_input.inspect}, {:one=>1}]\n" \
"+[#{actual_input.inspect}, {:one=>1}]\n"
- )
+
+ message = message.gsub('=>', ' => ') if RUBY_VERSION.to_f > 3.3
+
+ expect {
+ options = { one: 1 }
+ d.foo(actual_input, options)
+ }.to fail_with(message)
end
RUBY
end
@@ -232,6 +251,11 @@
def hash_regex_inspect(hash)
"\\{(#{hash.map { |key, value| "#{key.inspect}=>#{value.inspect}.*" }.join "|"}){#{hash.size}}\\}"
end
+ elsif RUBY_VERSION.to_f > 3.3
+ # Ruby head / 3.4 is changing the hash syntax inspect, but we use PP when diffing which just spaces out hashrockets
+ def hash_regex_inspect(hash)
+ Regexp.escape("{#{hash.map { |key, value| "#{key.inspect} => #{value.inspect}"}.join(", ")}}")
+ end
else
def hash_regex_inspect(hash)
Regexp.escape(hash.inspect)
diff --git a/spec/rspec/mocks/double_spec.rb b/spec/rspec/mocks/double_spec.rb
index d5dff63b3..ac65c590f 100644
--- a/spec/rspec/mocks/double_spec.rb
+++ b/spec/rspec/mocks/double_spec.rb
@@ -526,10 +526,17 @@ def initialize(amount, units)
if kw_args_supported?
it 'fails when calling yielding method with invalid kw args' do
+ message =
+ if RUBY_VERSION.to_f > 3.3
+ '#<Double "test double"> yielded |{:x => 1, :y => 2}| to block with optional keyword args (:x)'
+ else
+ '#<Double "test double"> yielded |{:x=>1, :y=>2}| to block with optional keyword args (:x)'
+ end
+
expect(@double).to receive(:yield_back).and_yield(:x => 1, :y => 2)
expect {
eval("@double.yield_back { |x: 1| }")
- }.to fail_with '#<Double "test double"> yielded |{:x=>1, :y=>2}| to block with optional keyword args (:x)'
+ }.to fail_with message
end
end
diff --git a/spec/rspec/mocks/hash_excluding_matcher_spec.rb b/spec/rspec/mocks/hash_excluding_matcher_spec.rb
index fc0faed05..3fca99823 100644
--- a/spec/rspec/mocks/hash_excluding_matcher_spec.rb
+++ b/spec/rspec/mocks/hash_excluding_matcher_spec.rb
@@ -4,7 +4,14 @@ module ArgumentMatchers
RSpec.describe HashExcludingMatcher do
it "describes itself properly" do
- expect(HashExcludingMatcher.new(:a => 5).description).to eq "hash_not_including(:a=>5)"
+ message =
+ if RUBY_VERSION.to_f > 3.3
+ "hash_not_including(a: 5)"
+ else
+ "hash_not_including(:a=>5)"
+ end
+
+ expect(HashExcludingMatcher.new(:a => 5).description).to eq message
end
describe "passing" do
diff --git a/spec/rspec/mocks/hash_including_matcher_spec.rb b/spec/rspec/mocks/hash_including_matcher_spec.rb
index ad5e8587a..057aec55d 100644
--- a/spec/rspec/mocks/hash_including_matcher_spec.rb
+++ b/spec/rspec/mocks/hash_including_matcher_spec.rb
@@ -4,7 +4,14 @@ module ArgumentMatchers
RSpec.describe HashIncludingMatcher do
it "describes itself properly" do
- expect(HashIncludingMatcher.new(:a => 1).description).to eq "hash_including(:a=>1)"
+ message =
+ if RUBY_VERSION.to_f > 3.3
+ "hash_including(a: 1)"
+ else
+ "hash_including(:a=>1)"
+ end
+
+ expect(HashIncludingMatcher.new(:a => 1).description).to eq message
end
it "describes passed matchers" do
diff --git a/spec/rspec/mocks/matchers/receive_spec.rb b/spec/rspec/mocks/matchers/receive_spec.rb
index 1b71dd58f..abf266935 100644
--- a/spec/rspec/mocks/matchers/receive_spec.rb
+++ b/spec/rspec/mocks/matchers/receive_spec.rb
@@ -130,7 +130,7 @@ def kw_args_method(a:, b:); end
dbl.kw_args_method(a: 1, b: 2)
end
- if RUBY_VERSION >= '3.0'
+ if RUBY_VERSION.to_f >= 3.0
it "fails to expect to receive hash with keyword args" do
expect {
dbl = instance_double(TestObject)
@@ -138,9 +138,16 @@ def kw_args_method(a:, b:); end
dbl.kw_args_method({a: 1, b: 2})
}.to fail_with do |failure|
reset_all
- expect(failure.message)
- .to include('expected: ({:a=>1, :b=>2}) (keyword arguments)')
- .and include('got: ({:a=>1, :b=>2}) (options hash)')
+
+ if RUBY_VERSION.to_f > 3.3
+ expect(failure.message)
+ .to include('expected: ({:a => 1, :b => 2}) (keyword arguments)')
+ .and include('got: ({:a => 1, :b => 2}) (options hash)')
+ else
+ expect(failure.message)
+ .to include('expected: ({:a=>1, :b=>2}) (keyword arguments)')
+ .and include('got: ({:a=>1, :b=>2}) (options hash)')
+ end
end
end
else
@@ -505,9 +512,14 @@ def receiver.method_missing(*); end # a poor man's stub...
receiver.foo(1, :bar => 2)
receiver.foo(1, :bar => 3)
- expect { verify_all }.to(
- raise_error(/received: 2 times with arguments: \(anything, hash_including\(:bar=>"anything"\)\)$/)
- )
+ message =
+ if RUBY_VERSION.to_f > 3.3
+ /received: 2 times with arguments: \(anything, hash_including\(bar: "anything"\)\)$/
+ else
+ /received: 2 times with arguments: \(anything, hash_including\(:bar=>"anything"\)\)$/
+ end
+
+ expect { verify_all }.to raise_error(message)
end
end
end
diff --git a/spec/rspec/mocks/verifying_doubles/expected_arg_verification_spec.rb b/spec/rspec/mocks/verifying_doubles/expected_arg_verification_spec.rb
index d39995341..1860afa1a 100644
--- a/spec/rspec/mocks/verifying_doubles/expected_arg_verification_spec.rb
+++ b/spec/rspec/mocks/verifying_doubles/expected_arg_verification_spec.rb
@@ -130,12 +130,19 @@ module Mocks
dbl.kw_args_method(1, :required_arg => 2, :optional_arg => 3)
end
- if RUBY_VERSION >= "3"
+ if RUBY_VERSION.to_f >= 3.0
it "fails to match against a hash submitted as a positional argument and received as keyword arguments in Ruby 3.0 or later", :reset => true do
+ messages =
+ if RUBY_VERSION.to_f > 3.3
+ ["expected: (1, {:optional_arg => 3, :required_arg => 2}) (keyword arguments)", "got: (1, {:optional_arg => 3, :required_arg => 2}) (options hash)"]
+ else
+ ["expected: (1, {:optional_arg=>3, :required_arg=>2}) (keyword arguments)", "got: (1, {:optional_arg=>3, :required_arg=>2}) (options hash)"]
+ end
+
expect(dbl).to receive(:kw_args_method).with(1, :required_arg => 2, :optional_arg => 3)
expect do
dbl.kw_args_method(1, {:required_arg => 2, :optional_arg => 3})
- end.to fail_with(a_string_including("expected: (1, {:optional_arg=>3, :required_arg=>2}) (keyword arguments)", "got: (1, {:optional_arg=>3, :required_arg=>2}) (options hash)"))
+ end.to fail_with(a_string_including(*messages))
end
else
it "matches against a hash submitted as a positional argument and received as keyword arguments in Ruby 2.7 or before" do

View file

@ -0,0 +1,190 @@
From 9310b4b72e205c6352c4b30015a3b8f3d2fb02e8 Mon Sep 17 00:00:00 2001
From: Jon Rowe <hello@jonrowe.co.uk>
Date: Thu, 26 Dec 2024 11:06:37 +0000
Subject: [PATCH 1/2] Format hashes in new {a: :b} format on Ruby 3.4
---
.../step_definitions/additional_cli_steps.rb | 2 +-
.../rspec/mocks/argument_matchers_spec.rb | 24 ++++++++++++++++---
rspec-mocks/spec/rspec/mocks/diffing_spec.rb | 17 +++++--------
rspec-mocks/spec/rspec/mocks/double_spec.rb | 2 +-
.../spec/rspec/mocks/matchers/receive_spec.rb | 4 ++--
.../expected_arg_verification_spec.rb | 2 +-
.../lib/rspec/support/object_formatter.rb | 2 ++
.../spec/rspec/support/differ_spec.rb | 2 +-
.../rspec/support/object_formatter_spec.rb | 22 +++++++++++++++--
9 files changed, 55 insertions(+), 22 deletions(-)
diff --git a/rspec-mocks/features/step_definitions/additional_cli_steps.rb b/rspec-mocks/features/step_definitions/additional_cli_steps.rb
index acf1117e0..9ccfac5b1 100644
--- a/rspec-mocks/features/step_definitions/additional_cli_steps.rb
+++ b/rspec-mocks/features/step_definitions/additional_cli_steps.rb
@@ -27,7 +27,7 @@
lines = table.raw.flatten.reject(&:empty?)
if ignore_hash_syntax && RUBY_VERSION.to_f > 3.3
- lines = lines.map { |line| line.gsub(/([^\s])=>/, '\1 => ') }
+ lines = lines.map { |line| line.gsub(/:(\w+)=>/, '\1: ') }
end
expect(all_output).to match_table(lines)
diff --git a/rspec-mocks/spec/rspec/mocks/argument_matchers_spec.rb b/rspec-mocks/spec/rspec/mocks/argument_matchers_spec.rb
index 8f31d1786..4bffa727d 100644
--- a/rspec-mocks/spec/rspec/mocks/argument_matchers_spec.rb
+++ b/rspec-mocks/spec/rspec/mocks/argument_matchers_spec.rb
@@ -431,7 +431,13 @@ def ==(other)
expect(a_double).to receive(:random_call).with(:a => "a", :b => "b")
expect do
a_double.random_call(opts)
- end.to fail_with(/expected: \(\{(:a\s*=>\s*\"a\", :b\s*=>\s*\"b\"|:b\s*=>\s*\"b\", :a\s*=>\s*\"a\")\}\)/)
+ end.to fail_with(
+ if RUBY_VERSION.to_f > 3.3
+ /expected: \(\{a: \"a\", b: \"b\"\}\)/
+ else
+ /expected: \(\{(:a\s*=>\s*\"a\", :b\s*=>\s*\"b\"|:b\s*=>\s*\"b\", :a\s*=>\s*\"a\")\}\)/
+ end
+ )
end
else
it "matches against a hash submitted as a positional argument and received as keyword arguments in Ruby 2.7 or before" do
@@ -445,14 +451,26 @@ def ==(other)
expect(a_double).to receive(:random_call).with(:a => "b", :c => "d")
expect do
a_double.random_call(:a => "b", :c => "e")
- end.to fail_with(/expected: \(\{(:a\s*=>\s*\"b\", :c\s*=>\s*\"d\"|:c\s*=>\s*\"d\", :a\s*=>\s*\"b\")\}\)/)
+ end.to fail_with(
+ if RUBY_VERSION.to_f > 3.3
+ /expected: \(\{a: \"b\", c: \"d\"\}\)/
+ else
+ /expected: \(\{(:a\s*=>\s*\"b\", :c\s*=>\s*\"d\"|:c\s*=>\s*\"d\", :a\s*=>\s*\"b\")\}\)/
+ end
+ )
end
it "fails for a hash w/ wrong keys", :reset => true do
expect(a_double).to receive(:random_call).with(:a => "b", :c => "d")
expect do
a_double.random_call("a" => "b", "c" => "d")
- end.to fail_with(/expected: \(\{(:a\s*=>\s*\"b\", :c\s*=>\s*\"d\"|:c\s*=>\s*\"d\", :a\s*=>\s*\"b\")\}\)/)
+ end.to fail_with(
+ if RUBY_VERSION.to_f > 3.3
+ /expected: \(\{a: \"b\", c: \"d\"\}\)/
+ else
+ /expected: \(\{(:a\s*=>\s*\"b\", :c\s*=>\s*\"d\"|:c\s*=>\s*\"d\", :a\s*=>\s*\"b\")\}\)/
+ end
+ )
end
it "matches a class against itself" do
diff --git a/rspec-mocks/spec/rspec/mocks/diffing_spec.rb b/rspec-mocks/spec/rspec/mocks/diffing_spec.rb
index f071cc1ec..b4492b4e8 100644
--- a/rspec-mocks/spec/rspec/mocks/diffing_spec.rb
+++ b/rspec-mocks/spec/rspec/mocks/diffing_spec.rb
@@ -105,7 +105,7 @@
" expected: ({:baz=>:quz, :foo=>:bar}) (keyword arguments)\n" \
" got: ({:baz=>:quz, :foo=>:bar}) (options hash)"
- message = message.gsub('=>', ' => ') if RUBY_VERSION.to_f > 3.3
+ message = message.gsub(/:(\w+)=>/, '\1: ') if RUBY_VERSION.to_f > 3.3
with_unfulfilled_double do |d|
expect(d).to receive(:foo).with(**expected_hash)
@@ -126,7 +126,7 @@
" expected: (:positional, {:keyword=>1}) (keyword arguments)\n" \
" got: (:positional, {:keyword=>1}) (options hash)"
- message = message.gsub('=>',' => ') if RUBY_VERSION.to_f > 3.3
+ message = message.gsub(/:(\w+)=>/, '\1: ') if RUBY_VERSION.to_f > 3.3
expect {
options = { keyword: 1 }
@@ -155,7 +155,7 @@
"-[#{expected_input.inspect}, {:one=>1}]\n" \
"+[#{actual_input.inspect}, {:one=>1}]\n"
- message = message.gsub('=>',' => ') if RUBY_VERSION.to_f > 3.3
+ message = message.gsub(/:(\w+)=>/, '\1: ') if RUBY_VERSION.to_f > 3.3
expect {
options = { one: 1 }
@@ -187,7 +187,7 @@
" expected: (:positional, {:baz=>:quz, :foo=>:bar}) (keyword arguments)\n" \
" got: (:positional, {:baz=>:quz, :foo=>:bar}) (options hash)"
- message.gsub!('=>',' => ') if RUBY_VERSION.to_f > 3.3
+ message = message.gsub(/:(\w+)=>/, '\1: ') if RUBY_VERSION.to_f > 3.3
expect(d).to receive(:foo).with(:positional, **expected_hash)
expect {
@@ -203,7 +203,7 @@
" expected: (:positional, {:keyword=>1}) (keyword arguments)\n" \
" got: (:positional, {:keyword=>1}) (options hash)"
- message.gsub!('=>',' => ') if RUBY_VERSION.to_f > 3.3
+ message = message.gsub(/:(\w+)=>/, '\1: ') if RUBY_VERSION.to_f > 3.3
expect(d).to receive(:foo).with(:positional, keyword: 1)
expect {
@@ -231,7 +231,7 @@
"-[#{expected_input.inspect}, {:one=>1}]\n" \
"+[#{actual_input.inspect}, {:one=>1}]\n"
- message = message.gsub('=>', ' => ') if RUBY_VERSION.to_f > 3.3
+ message = message.gsub(/:(\w+)=>/, '\1: ') if RUBY_VERSION.to_f > 3.3
expect {
options = { one: 1 }
@@ -251,11 +251,6 @@
def hash_regex_inspect(hash)
"\\{(#{hash.map { |key, value| "#{key.inspect}=>#{value.inspect}.*" }.join "|"}){#{hash.size}}\\}"
end
- elsif RUBY_VERSION.to_f > 3.3
- # Ruby head / 3.4 is changing the hash syntax inspect, but we use PP when diffing which just spaces out hashrockets
- def hash_regex_inspect(hash)
- Regexp.escape("{#{hash.map { |key, value| "#{key.inspect} => #{value.inspect}"}.join(", ")}}")
- end
else
def hash_regex_inspect(hash)
Regexp.escape(hash.inspect)
diff --git a/rspec-mocks/spec/rspec/mocks/double_spec.rb b/rspec-mocks/spec/rspec/mocks/double_spec.rb
index ac65c590f..9738edfa7 100644
--- a/rspec-mocks/spec/rspec/mocks/double_spec.rb
+++ b/rspec-mocks/spec/rspec/mocks/double_spec.rb
@@ -528,7 +528,7 @@ def initialize(amount, units)
it 'fails when calling yielding method with invalid kw args' do
message =
if RUBY_VERSION.to_f > 3.3
- '#<Double "test double"> yielded |{:x => 1, :y => 2}| to block with optional keyword args (:x)'
+ '#<Double "test double"> yielded |{x: 1, y: 2}| to block with optional keyword args (:x)'
else
'#<Double "test double"> yielded |{:x=>1, :y=>2}| to block with optional keyword args (:x)'
end
diff --git a/rspec-mocks/spec/rspec/mocks/matchers/receive_spec.rb b/rspec-mocks/spec/rspec/mocks/matchers/receive_spec.rb
index 3e71bd289..307c86a6f 100644
--- a/rspec-mocks/spec/rspec/mocks/matchers/receive_spec.rb
+++ b/rspec-mocks/spec/rspec/mocks/matchers/receive_spec.rb
@@ -141,8 +141,8 @@ def kw_args_method(a:, b:); end
if RUBY_VERSION.to_f > 3.3
expect(failure.message)
- .to include('expected: ({:a => 1, :b => 2}) (keyword arguments)')
- .and include('got: ({:a => 1, :b => 2}) (options hash)')
+ .to include('expected: ({a: 1, b: 2}) (keyword arguments)')
+ .and include('got: ({a: 1, b: 2}) (options hash)')
else
expect(failure.message)
.to include('expected: ({:a=>1, :b=>2}) (keyword arguments)')
diff --git a/rspec-mocks/spec/rspec/mocks/verifying_doubles/expected_arg_verification_spec.rb b/rspec-mocks/spec/rspec/mocks/verifying_doubles/expected_arg_verification_spec.rb
index a3f3d2034..48646a1e6 100644
--- a/rspec-mocks/spec/rspec/mocks/verifying_doubles/expected_arg_verification_spec.rb
+++ b/rspec-mocks/spec/rspec/mocks/verifying_doubles/expected_arg_verification_spec.rb
@@ -134,7 +134,7 @@ module Mocks
it "fails to match against a hash submitted as a positional argument and received as keyword arguments in Ruby 3.0 or later", :reset => true do
messages =
if RUBY_VERSION.to_f > 3.3
- ["expected: (1, {:optional_arg => 3, :required_arg => 2}) (keyword arguments)", "got: (1, {:optional_arg => 3, :required_arg => 2}) (options hash)"]
+ ["expected: (1, {optional_arg: 3, required_arg: 2}) (keyword arguments)", "got: (1, {optional_arg: 3, required_arg: 2}) (options hash)"]
else
["expected: (1, {:optional_arg=>3, :required_arg=>2}) (keyword arguments)", "got: (1, {:optional_arg=>3, :required_arg=>2}) (options hash)"]
end

View file

@ -0,0 +1,35 @@
From 939c4799993b7ff7e524fac701ae6490772ca6de Mon Sep 17 00:00:00 2001
From: Jon Rowe <hello@jonrowe.co.uk>
Date: Mon, 1 Dec 2025 14:08:25 +0000
Subject: [PATCH] Skip mock for calls to `:respond_to?` from `Kernel#inspect`
---
rspec-mocks/lib/rspec/mocks/method_double.rb | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/rspec-mocks/lib/rspec/mocks/method_double.rb b/rspec-mocks/lib/rspec/mocks/method_double.rb
index e2edb1e21..3276c49a5 100644
--- a/rspec-mocks/lib/rspec/mocks/method_double.rb
+++ b/rspec-mocks/lib/rspec/mocks/method_double.rb
@@ -68,8 +68,19 @@ def define_proxy_method
save_original_implementation_callable!
definition_target.class_exec(self, method_name, @original_visibility || visibility) do |method_double, method_name, visibility|
- define_method(method_name) do |*args, &block|
- method_double.proxy_method_invoked(self, *args, &block)
+ if RUBY_VERSION.to_f > 3 && method_name == :respond_to?
+ define_method(method_name) do |*args, &block|
+ # This is a work around for a respond_to? check within kernel_inspect
+ if caller_locations[0].label == "Kernel#inspect"
+ super(*args, &block)
+ else
+ method_double.proxy_method_invoked(self, *args, &block)
+ end
+ end
+ else
+ define_method(method_name) do |*args, &block|
+ method_double.proxy_method_invoked(self, *args, &block)
+ end
end
# This can't be `if respond_to?(:ruby2_keywords, true)`,
# see https://github.com/rspec/rspec-mocks/pull/1385#issuecomment-755340298

View file

@ -0,0 +1,26 @@
#!/bin/bash
if [ $# -lt 2 ]
then
echo "$0 <name> <version>"
exit 1
fi
set -x
set -e
CURRDIR=$(pwd)
TMPDIRPATH=$(mktemp -d /var/tmp/rspec-tar-XXXXXX)
pushd $TMPDIRPATH
git clone https://github.com/rspec/rspec.git
pushd rspec
git reset --hard $1-v$2
ln -sf $1 $1-$2
tar czf ${CURRDIR}/rubygem-$1-$2-full.tar.gz $1-$2/./
popd
rm -rf $TMPDIRPATH

447
rubygem-rspec-mocks.spec Normal file
View file

@ -0,0 +1,447 @@
%global majorver 3.13.7
#%%global preminorver .rc6
%global rpmminorver .%(echo %preminorver | sed -e 's|^\\.\\.*||')
%global fullver %{majorver}%{?preminorver}
%global baserelease 2
%global gem_name rspec-mocks
%bcond_with bootstrap
%undefine __brp_mangle_shebangs
Summary: RSpec's 'test double' framework (mocks and stubs)
Name: rubygem-%{gem_name}
Version: %{majorver}
Release: %{?preminorver:0.}%{baserelease}%{?preminorver:%{rpmminorver}}%{?dist}
# SPDX confirmed
License: MIT
URL: https://rspec.info
Source0: https://rubygems.org/gems/%{gem_name}-%{fullver}.gem
# %%{SOURCE2} %%{name} %%{version}
Source1: rubygem-%{gem_name}-%{version}-full.tar.gz
Source2: rspec-related-create-full-tarball.sh
# https://github.com/rspec/rspec/pull/282/commits/939c4799993b7ff7e524fac701ae6490772ca6de
# Skip mock for ruby4_0 Kernel#inspect
Patch0: rspec-mocks-pr282-skip-mock-for-ruby4_0-inspect.patch
BuildRequires: rubygems-devel
%if %{without bootstrap}
# rspec
BuildRequires: rubygem(rspec)
BuildRequires: rubygem(rake)
%if %{undefined rhel}
# cucumber
BuildRequires: rubygem(aruba)
BuildRequires: rubygem(cucumber)
BuildRequires: rubygem(minitest)
%endif
BuildRequires: git
%endif
BuildArch: noarch
%description
rspec-mocks provides a test-double framework for rspec including support
for method stubs, fakes, and message expectations.
%package doc
Summary: Documentation for %{name}
Requires: %{name} = %{version}-%{release}
%description doc
This package contains documentation for %{name}.
%prep
gem unpack %{SOURCE0}
%setup -q -D -T -n %{gem_name}-%{version} -b 1
%patch -P0 -p2
# Cucumber 7 syntax change
sed -i cucumber.yml -e "s|~@wip|not @wip|"
sed -i features/support/disallow_certain_apis.rb -e "s|~@allow-old-syntax|not @allow-old-syntax|"
gem specification %{SOURCE0} -l --ruby > %{gem_name}.gemspec
%build
gem build %{gem_name}.gemspec
%gem_install
%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
%{buildroot}%{gem_dir}/
# cleanups
rm -f %{buildroot}%{gem_instdir}/{.document,.yardopts}
%check
%if %{with bootstrap}
# Don't do actual check
exit 0
%endif
%if %{defined rhel}
# avoid aruba dep on RHEL, but tests fail if files are removed entirely
echo -n > spec/integration/rails_support_spec.rb
echo -n > spec/support/aruba.rb
%else
# Don't call bundler
sed -i spec/integration/rails_support_spec.rb \
-e 's|bundle exec rspec|rspec|'
%endif
# library_wide_checks.rb needs UTF-8
LANG=C.UTF-8
export RUBYLIB=$(pwd)/lib
rspec spec/
%if 0%{?rhel}
# Don't do cucumber test
exit 0
%endif
export CUCUMBER_PUBLISH_QUIET=true
cucumber
%files
%dir %{gem_instdir}
%license %{gem_instdir}/LICENSE.md
%doc %{gem_instdir}/Changelog.md
%doc %{gem_instdir}/README.md
%{gem_instdir}/lib/
%exclude %{gem_cache}
%{gem_spec}
%files doc
%{gem_docdir}
%changelog
* Tue Dec 02 2025 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.13.7-2
- Backport upstream patch to skip mock for Kernel#inspect on ruby4_0
* Mon Nov 24 2025 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.13.7-1
- 3.13.7
* Fri Oct 17 2025 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.13.6-1
- 3.13.6
* Fri Jul 25 2025 Fedora Release Engineering <releng@fedoraproject.org> - 3.13.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Thu May 29 2025 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.13.5-1
- 3.13.5
* Thu May 15 2025 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.13.4-1
- 3.13.4
* Sat Jan 18 2025 Fedora Release Engineering <releng@fedoraproject.org> - 3.13.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Sun Dec 29 2024 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.13.2-3
- Coordinate with rspec-support change wrt ruby34 hash inspect support
* Wed Nov 06 2024 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.13.2-2
- Backport upstream patch to support ruby34 formatting
* Thu Oct 03 2024 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.13.2-1
- 3.13.2
* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.13.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Thu May 09 2024 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.13.1-1
- 3.13.1
* Thu Apr 18 2024 Jun Aruga <jaruga@redhat.com> - 3.13.0-2
- Remove unused thread_order build dependency
* Fri Feb 09 2024 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.13.0-1
- 3.13.0
* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.12.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.12.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Sun Jul 16 2023 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.12.6-1
- 3.12.6
* Sat Apr 1 2023 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.12.5-1
- 3.12.5
* Tue Mar 14 2023 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.12.4-1
- 3.12.4
* Thu Mar 09 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 3.12.3-2
- Disable unwanted dependencies in RHEL builds
* Thu Feb 16 2023 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.12.3-1
- 3.12.3
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.12.0-3.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Fri Dec 2 2022 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.12.0-3
- Backport upstream reviewing patch for ruby32 ruby2_keywords treatment change
* Thu Nov 3 2022 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.12.0-2
- On Fedora 37, remove "Display keyword hashes" feature for now
(On Fedora 38, this is effective)
* Thu Oct 27 2022 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.12.0-1
- 3.12.0
* Wed Oct 26 2022 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.11.2-1
- 3.11.2
* Mon Oct 3 2022 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.11.1-2
- Backport upstream patch for ruby32 wrt method reference changes
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.11.1-1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Thu Apr 7 2022 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.11.1-1
- 3.11.1
* Thu Feb 10 2022 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.11.0-1
- 3.11.0
* Sun Jan 30 2022 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.10.3-1
- 3.10.3
* Sun Jan 30 2022 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.10.2-3
- BR: rubygem(rake) for check
* Thu Jan 20 2022 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.10.2-2
- Execute cucumber test
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.10.2-1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Mon Feb 1 2021 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.10.2-1
- 3.10.2
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.10.1-1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Dec 29 2020 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.10.1-1
- 3.10.1
* Fri Dec 11 2020 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.10.0-1
- Enable tests again
* Fri Dec 11 2020 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.10.0-0.1
- 3.10.0
- Once disable test for bootstrap
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.9.1-1.2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.9.1-1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Jan 2 2020 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.9.1-1
- 3.9.1
* Tue Dec 10 2019 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.9.0-2
- Enable tests again
* Tue Dec 10 2019 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.9.0-0.1
- 3.9.0
- Once disable test for bootstrap
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.8.1-1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Jun 21 2019 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.8.1-1
- 3.8.1
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.8.0-1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Dec 13 2018 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.8.0-1
- Enable tests again
* Wed Dec 12 2018 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.8.0-0.1
- 3.8.0
- Once disable test for bootstrap
* Sun Nov 18 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.7.0-3.2
- Use C.UTF-8 locale
See https://fedoraproject.org/wiki/Changes/Remove_glibc-langpacks-all_from_buildroot
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.0-3.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Wed Feb 14 2018 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.7.1-3
- Backport patch to fix test failure with ruby 2.5
* Tue Feb 13 2018 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.7.1-2
- ruby 2.5 drops -rubygems usage
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.0-1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Mon Nov 13 2017 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.7.0-1
- Enable tests again
* Mon Nov 13 2017 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.7.0-0.1
- 3.7.0
- Once disable tests
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.6.0-1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Sat May 6 2017 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.6.0-1
- Enable tests again
* Sat May 6 2017 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.6.0-0.1
- 3.6.0
- Once disable tests
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.0-2.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Tue Jan 17 2017 Vít Ondruch <vondruch@redhat.com> - 3.5.0-2
- Fix Ruby 2.4 compatibility.
* Sun Jul 24 2016 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.5.0-1
- Enable tests again
* Sat Jul 23 2016 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.5.0-0.1
- 3.5.0
- Once disable tests
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.4.1-1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Thu Jan 14 2016 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.4.1-1
- 3.4.1
* Tue Dec 8 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.4.0-2
- Enable tests again
* Tue Dec 8 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.4.0-1
- 3.4.0
- Once disable tests
* Wed Aug 12 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.3.2-3
- Enable thread_order dependent tests
* Sun Aug 2 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.3.2-2
- Enable tests again
* Sun Aug 2 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.3.2-1
- 3.3.2
- Once disable tests
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2.1-1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Wed Feb 25 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.2.1-1
- 3.2.1
* Mon Feb 9 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.2.0-2
- Enable tests again
* Mon Feb 9 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.2.0-1
- 3.2.0
- Once disable tests
* Mon Nov 10 2014 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.1.3-2
- Enable tests
* Mon Nov 10 2014 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.1.3-1
- 3.1.3
- Once disable tests
* Fri Aug 15 2014 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.0.4-1
- 3.0.4
* Thu Aug 14 2014 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.0.3-1
- 3.0.3
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.14.6-1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Thu Feb 27 2014 Mamoru TASAKA <mtasaka@fedoraproject.org> - 2.14.6-1
- 2.14.6
* Tue Feb 4 2014 Mamoru TASAKA <mtasaka@fedoraproject.org> - 2.14.5-1
- 2.14.5
* Thu Oct 24 2013 Mamoru TASAKA <mtasaka@fedoraproject.org> - 2.14.4-1
- 2.14.4
* Fri Aug 16 2013 Mamoru TASAKA <mtasaka@fedoraproject.org> - 2.14.3-2
- Enable test suite again
* Fri Aug 16 2013 Mamoru TASAKA <mtasaka@fedoraproject.org> - 2.14.3-1
- 2.14.3
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.13.1-1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Fri Apr 12 2013 Mamoru TASAKA <mtasaka@fedoraproject.org> - 2.13.1-1
- 2.13.1
* Thu Mar 28 2013 Mamoru TASAKA <mtasaka@fedoraproject.org> - 2.13.0-2
- Enable test suite again
* Thu Mar 28 2013 Mamoru TASAKA <mtasaka@fedoraproject.org> - 2.13.0-1
- 2.13.0
* Wed Feb 20 2013 Vít Ondruch <vondruch@redhat.com> - 2.12.2-2
- Rebuild for https://fedoraproject.org/wiki/Features/Ruby_2.0.0
* Mon Feb 4 2013 Mamoru TASAKA <mtasaka@fedoraproject.org> - 2.12.2-1
- 2.12.2
* Wed Jan 2 2013 Mamoru TASAKA <mtasaka@fedoraproject.org> - 2.12.1-2
- Enable test suite again
* Wed Jan 2 2013 Mamoru TASAKA <mtasaka@fedoraproject.org> - 2.12.1-1
- 2.12.1
* Thu Oct 11 2012 Mamoru Tasaka <mtasaka@fedoraproject.org> - 2.11.3-1
- 2.11.3
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.8.0-1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Sun Jan 22 2012 Mamoru Tasaka <mtasaka@fedoraproject.org> - 2.8.0-1
- 2.8.0
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.6.0-1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Mon May 16 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 2.6.0-1
- 2.6.0
* Tue May 10 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 2.6.0-0.3.rc6
- 2.6.0 rc6
* Tue May 3 2011 Mamoru Tasaka <mtasaka@fedoraproject.org>
- And enable check on rawhide
* Tue May 3 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 2.6.0-0.1.rc4
- 2.6.0 rc4
* Sat Feb 26 2011 Mamoru Tasaka <mtasaka@fedoraproject.org>
- And enable check on rawhide
* Sat Feb 26 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 2.5.0-2
- Cleanups
* Thu Feb 17 2011 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 2.5.0-1
- 2.5.0
* Fri Nov 05 2010 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 2.0.1-1
- Initial package

View file

@ -0,0 +1,2 @@
SHA512 (rspec-mocks-3.13.7.gem) = fa30824f1d7ab82e2c0d1cde1f076cb84b9a9e1e9e7292e33bcfda934468a50f2b59a1dc539137be14ad5b86465ed6fa12c32af2e3a79992c3ce5d278072861c
SHA512 (rubygem-rspec-mocks-3.13.7-full.tar.gz) = 7666b07e6b9806e36d53ede810c6efc0ceb57bc554c96e0fdf44efbfd9dd027a8e999ce942d20bf46f93f93bfae1a88c7ffd0bfbf2cdf08601093a98218a059a