Compare commits
No commits in common. "rawhide" and "f44" have entirely different histories.
6 changed files with 48 additions and 175 deletions
33
flexmock-3.0.2-ruby34-string-literal-frozen.patch
Normal file
33
flexmock-3.0.2-ruby34-string-literal-frozen.patch
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
diff -urp '--exclude=*~' flexmock-3.0.2.orig/lib/flexmock/spy_describers.rb flexmock-3.0.2/lib/flexmock/spy_describers.rb
|
||||||
|
--- flexmock-3.0.2.orig/lib/flexmock/spy_describers.rb 2025-08-13 16:49:42.102930421 +0900
|
||||||
|
+++ flexmock-3.0.2/lib/flexmock/spy_describers.rb 2025-08-13 16:56:27.493387656 +0900
|
||||||
|
@@ -18,7 +18,7 @@ class FlexMock
|
||||||
|
end
|
||||||
|
|
||||||
|
def describe_spy(spy, sym, args, kw, options, not_clause="")
|
||||||
|
- result = "expected "
|
||||||
|
+ result = "expected ".dup
|
||||||
|
result << FlexMock.format_call(sym, args, kw)
|
||||||
|
result << " to#{not_clause} be received by " << spy.inspect
|
||||||
|
result << times_description(options[:times])
|
||||||
|
@@ -29,7 +29,7 @@ class FlexMock
|
||||||
|
end
|
||||||
|
|
||||||
|
def describe_calls(spy)
|
||||||
|
- result = ''
|
||||||
|
+ result = ''.dup
|
||||||
|
if spy.flexmock_calls.empty?
|
||||||
|
result << "No messages have been received\n"
|
||||||
|
else
|
||||||
|
diff -urp '--exclude=*~' flexmock-3.0.2.orig/test/container_methods_test.rb flexmock-3.0.2/test/container_methods_test.rb
|
||||||
|
--- flexmock-3.0.2.orig/test/container_methods_test.rb 2025-08-13 16:49:41.505249913 +0900
|
||||||
|
+++ flexmock-3.0.2/test/container_methods_test.rb 2025-08-13 18:12:33.787388043 +0900
|
||||||
|
@@ -112,7 +112,7 @@ class TestFlexmockContainerMethods < Min
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_stubbing_a_string
|
||||||
|
- s = "hello"
|
||||||
|
+ s = "hello".dup
|
||||||
|
flexmock(:base, s, :length => 2)
|
||||||
|
assert_equal 2, s.length
|
||||||
|
end
|
||||||
12
flexmock-3.0.2-testsuite-ruby34-formatting.patch
Normal file
12
flexmock-3.0.2-testsuite-ruby34-formatting.patch
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
diff -urp flexmock.orig/test/partial_mock_test.rb flexmock/test/partial_mock_test.rb
|
||||||
|
--- flexmock.orig/test/partial_mock_test.rb 2024-11-18 15:38:57.625597258 +0900
|
||||||
|
+++ flexmock/test/partial_mock_test.rb 2024-11-18 15:44:56.469851634 +0900
|
||||||
|
@@ -633,7 +633,7 @@ class TestStubbing < Minitest::Test
|
||||||
|
exception = assert_raises(NameError) do
|
||||||
|
obj.mocked_method
|
||||||
|
end
|
||||||
|
- assert_match(/undefined method `does_not_exist' for/, exception.message)
|
||||||
|
+ assert_match(/undefined method [`']does_not_exist' for/, exception.message)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_it_checks_whether_mocks_are_forbidden_before_forwarding_the_call
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
From ead3616ca6af80144b1f884c2eb9d0fbf9e09dbc Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mamoru TASAKA <mtasaka@fedoraproject.org>
|
|
||||||
Date: Wed, 22 Apr 2026 16:57:57 +0900
|
|
||||||
Subject: [PATCH 2/2] fix: suppress for literal string being frozen in the
|
|
||||||
future
|
|
||||||
|
|
||||||
ruby 3.4 emits warnings when trying to modify literal string.
|
|
||||||
Use unary plus operator to avoid this.
|
|
||||||
|
|
||||||
Part of #37 .
|
|
||||||
---
|
|
||||||
lib/flexmock/spy_describers.rb | 4 ++--
|
|
||||||
test/container_methods_test.rb | 2 +-
|
|
||||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/lib/flexmock/spy_describers.rb b/lib/flexmock/spy_describers.rb
|
|
||||||
index 9e6105f..db7c27a 100644
|
|
||||||
--- a/lib/flexmock/spy_describers.rb
|
|
||||||
+++ b/lib/flexmock/spy_describers.rb
|
|
||||||
@@ -18,7 +18,7 @@ def describe_spy_negative_expectation(spy, sym, args, kw, options={})
|
|
||||||
end
|
|
||||||
|
|
||||||
def describe_spy(spy, sym, args, kw, options, not_clause="")
|
|
||||||
- result = "expected "
|
|
||||||
+ result = +"expected "
|
|
||||||
result << FlexMock.format_call(sym, args, kw)
|
|
||||||
result << " to#{not_clause} be received by " << spy.inspect
|
|
||||||
result << times_description(options[:times])
|
|
||||||
@@ -29,7 +29,7 @@ def describe_spy(spy, sym, args, kw, options, not_clause="")
|
|
||||||
end
|
|
||||||
|
|
||||||
def describe_calls(spy)
|
|
||||||
- result = ''
|
|
||||||
+ result = +''
|
|
||||||
if spy.flexmock_calls.empty?
|
|
||||||
result << "No messages have been received\n"
|
|
||||||
else
|
|
||||||
diff --git a/test/container_methods_test.rb b/test/container_methods_test.rb
|
|
||||||
index 0c32d80..fca9319 100644
|
|
||||||
--- a/test/container_methods_test.rb
|
|
||||||
+++ b/test/container_methods_test.rb
|
|
||||||
@@ -113,7 +113,7 @@ def test_stubs_are_auto_verified
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_stubbing_a_string
|
|
||||||
- s = "hello"
|
|
||||||
+ s = +"hello"
|
|
||||||
flexmock(:base, s, :length => 2)
|
|
||||||
assert_equal 2, s.length
|
|
||||||
end
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
From e38c5d27a300cc6a7ee458c76dae6e0dcb2db640 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mamoru TASAKA <mtasaka@fedoraproject.org>
|
|
||||||
Date: Wed, 22 Apr 2026 16:49:46 +0900
|
|
||||||
Subject: [PATCH 1/2] fix ruby3.4 formatting change
|
|
||||||
|
|
||||||
ruby 3.4 changes formatting for some backtrace messages.
|
|
||||||
Support this using regex.
|
|
||||||
|
|
||||||
Closes #37 .
|
|
||||||
---
|
|
||||||
test/partial_mock_test.rb | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/test/partial_mock_test.rb b/test/partial_mock_test.rb
|
|
||||||
index beb8f8f..b0f41d2 100644
|
|
||||||
--- a/test/partial_mock_test.rb
|
|
||||||
+++ b/test/partial_mock_test.rb
|
|
||||||
@@ -634,7 +634,7 @@ def test_partial_mocks_leaves_NoMethodError_exceptions_raised_by_the_original_me
|
|
||||||
exception = assert_raises(NameError) do
|
|
||||||
obj.mocked_method
|
|
||||||
end
|
|
||||||
- assert_match(/undefined method `does_not_exist' for/, exception.message)
|
|
||||||
+ assert_match(/undefined method [`']does_not_exist' for/, exception.message)
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_it_checks_whether_mocks_are_forbidden_before_forwarding_the_call
|
|
||||||
|
|
@ -1,82 +0,0 @@
|
||||||
From bdde505f4c8fd8028f9da2f92505bba12e225635 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mamoru TASAKA <mtasaka@fedoraproject.org>
|
|
||||||
Date: Wed, 22 Apr 2026 18:35:52 +0900
|
|
||||||
Subject: [PATCH] fix: Use Minitest assert_raises correctly and handle error
|
|
||||||
message
|
|
||||||
|
|
||||||
Actually
|
|
||||||
https://github.com/minitest/minitest/blob/v6.0.5/lib/minitest/assertions.rb#L390
|
|
||||||
says that `assert_raises` can take an optional "message" (i.e. string) to help
|
|
||||||
explain failures, so not regex or so to test if assertion message matches it.
|
|
||||||
|
|
||||||
Up to Minitest 6.0.4, when passing regex for `assert_raises` it was simply
|
|
||||||
ignored, ref:
|
|
||||||
|
|
||||||
https://github.com/minitest/minitest/issues/1068
|
|
||||||
https://bugs.ruby-lang.org/issues/22007
|
|
||||||
|
|
||||||
Now Minitest 6.0.5 explicitly refuses this usage as:
|
|
||||||
https://github.com/minitest/minitest/commit/6790f86f894637768a1f64cfe50959d2029b65ed
|
|
||||||
|
|
||||||
Closes #39 .
|
|
||||||
---
|
|
||||||
test/based_partials_test.rb | 3 ++-
|
|
||||||
test/partial_mock_test.rb | 9 ++++++---
|
|
||||||
2 files changed, 8 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/test/based_partials_test.rb b/test/based_partials_test.rb
|
|
||||||
index b9efcf5..fca2b61 100644
|
|
||||||
--- a/test/based_partials_test.rb
|
|
||||||
+++ b/test/based_partials_test.rb
|
|
||||||
@@ -46,9 +46,10 @@ def test_based_partials_allow_stubbing_defined_methods
|
|
||||||
|
|
||||||
def test_based_partials_disallow_stubbing_undefined_methods
|
|
||||||
dog = Dog.new
|
|
||||||
- assert_raises(NoMethodError, /cannot stub.*wag.*explicitly/) do
|
|
||||||
+ ex = assert_raises(NoMethodError) do
|
|
||||||
flexmock(dog).should_receive(:wag => :mock_value)
|
|
||||||
end
|
|
||||||
+ assert_match(/Cannot stub.*wag.*explicitly/m, ex.message)
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_based_partials_allow_explicitly_stubbing_undefined_methods
|
|
||||||
diff --git a/test/partial_mock_test.rb b/test/partial_mock_test.rb
|
|
||||||
index beb8f8f..629e12e 100644
|
|
||||||
--- a/test/partial_mock_test.rb
|
|
||||||
+++ b/test/partial_mock_test.rb
|
|
||||||
@@ -457,9 +457,10 @@ def test_partial_mocks_allow_stubbing_defined_methods_when_using_on
|
|
||||||
def test_partial_mocks_disallow_stubbing_undefined_methods_when_using_on
|
|
||||||
dog = Dog.new
|
|
||||||
flexmock(dog, :on, Dog)
|
|
||||||
- assert_raises(NoMethodError, /meow.*explicitly/) do
|
|
||||||
+ ex = assert_raises(NoMethodError) do
|
|
||||||
dog.should_receive(:meow).and_return(:something)
|
|
||||||
end
|
|
||||||
+ assert_match(/meow.*explicitly/m, ex.message)
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_partial_mocks_properly_detect_methods_defined_through_a_class_hierarchy
|
|
||||||
@@ -497,9 +498,10 @@ def test_partial_mocks_will_not_require_explicitly_on_a_class_singleton_method_t
|
|
||||||
def test_based_partial_mocks_require_explicitly_on_a_non_existing_method_of_a_class_singleton
|
|
||||||
dog = Class.new
|
|
||||||
FlexMock.partials_are_based = true
|
|
||||||
- assert_raises(NoMethodError, /bark.*explicitly/) do
|
|
||||||
+ ex = assert_raises(NoMethodError) do
|
|
||||||
flexmock(dog).should_receive(:bark).and_return(:grrr)
|
|
||||||
end
|
|
||||||
+ assert_match(/bark.*explicitly/m, ex.message)
|
|
||||||
ensure
|
|
||||||
FlexMock.partials_are_based = false
|
|
||||||
end
|
|
||||||
@@ -511,9 +513,10 @@ def test_partial_mocks_require_explicitly_on_a_class_singleton_method_that_has_b
|
|
||||||
FlexMock.partials_are_based = true
|
|
||||||
flexmock(dog).should_receive(:bark).explicitly
|
|
||||||
flexmock(chiwawa)
|
|
||||||
- assert_raises(NoMethodError, /bark.*explicitly/) do
|
|
||||||
+ ex = assert_raises(NoMethodError) do
|
|
||||||
chiwawa.should_receive(:bark).and_return(:grrr)
|
|
||||||
end
|
|
||||||
+ assert_match(/bark.*explicitly/m, ex.message)
|
|
||||||
ensure
|
|
||||||
FlexMock.partials_are_based = false
|
|
||||||
end
|
|
||||||
|
|
@ -3,23 +3,17 @@
|
||||||
Summary: Mock object library for ruby
|
Summary: Mock object library for ruby
|
||||||
Name: rubygem-%{gem_name}
|
Name: rubygem-%{gem_name}
|
||||||
Version: 3.0.2
|
Version: 3.0.2
|
||||||
Release: 4%{?dist}
|
Release: 2%{?dist}
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: https://github.com/doudou/flexmock
|
URL: https://github.com/doudou/flexmock
|
||||||
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
|
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
|
||||||
Source1: %{gem_name}-%{version}-test-missing-files.tar.gz
|
Source1: %{gem_name}-%{version}-test-missing-files.tar.gz
|
||||||
# Source1 is created fron Source2
|
# Source1 is created fron Source2
|
||||||
Source2: flexmock-create-missing-test-files.sh
|
Source2: flexmock-create-missing-test-files.sh
|
||||||
# https://github.com/doudou/flexmock/pull/38/changes/e38c5d27a300cc6a7ee458c76dae6e0dcb2db640
|
|
||||||
# make testsuite compatible for ruby34 formatting change
|
# make testsuite compatible for ruby34 formatting change
|
||||||
Patch0: flexmock-pr38-3.0.2-testsuite-ruby34-formatting.patch
|
Patch0: flexmock-3.0.2-testsuite-ruby34-formatting.patch
|
||||||
# https://github.com/doudou/flexmock/pull/38/changes/ead3616ca6af80144b1f884c2eb9d0fbf9e09dbc
|
|
||||||
# Remove warnings for string literal being frozen in the future
|
# Remove warnings for string literal being frozen in the future
|
||||||
Patch1: flexmock-pr38-3.0.2-ruby34-string-literal-frozen.patch
|
Patch1: flexmock-3.0.2-ruby34-string-literal-frozen.patch
|
||||||
# https://github.com/doudou/flexmock/pull/40
|
|
||||||
# Fix assert_raises usage with Minitest 6.0.5
|
|
||||||
Patch2: flexmock-pr40-fix-minitest-assert_raises-usage.patch
|
|
||||||
|
|
||||||
|
|
||||||
Requires: ruby(release)
|
Requires: ruby(release)
|
||||||
BuildRequires: ruby(release)
|
BuildRequires: ruby(release)
|
||||||
|
|
@ -49,7 +43,6 @@ mv flexmock/test .
|
||||||
|
|
||||||
%patch -P0 -p1
|
%patch -P0 -p1
|
||||||
%patch -P1 -p1
|
%patch -P1 -p1
|
||||||
%patch -P2 -p1
|
|
||||||
|
|
||||||
find . -name \*.rb | xargs sed -i -e '\@/usr/bin/env@d'
|
find . -name \*.rb | xargs sed -i -e '\@/usr/bin/env@d'
|
||||||
find . -name \*.gem -or -name \*.rb -or -name \*.rdoc | xargs chmod 0644
|
find . -name \*.gem -or -name \*.rb -or -name \*.rdoc | xargs chmod 0644
|
||||||
|
|
@ -108,13 +101,6 @@ popd
|
||||||
%{gem_docdir}/
|
%{gem_docdir}/
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Thu Jul 16 2026 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.2-4
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild
|
|
||||||
|
|
||||||
* Wed Apr 22 2026 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.0.2-3
|
|
||||||
- Use upstream PR for patches
|
|
||||||
- Backport upstream PR for Minitest 6.0.5 compatibility
|
|
||||||
|
|
||||||
* Sat Jan 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.2-2
|
* Sat Jan 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.2-2
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue