dev-ruby/flexmock: add ruby30, ruby31, ruby32

Use debian patches from upstream pull request that is still pending.

Signed-off-by: Hans de Graaff <graaff@gentoo.org>
This commit is contained in:
Hans de Graaff
2023-03-26 11:23:55 +02:00
parent 661b50cf08
commit 08de07e693
4 changed files with 117 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
From f63ba0916132e16d5eeb1a5c1ad868b0169bf7fc Mon Sep 17 00:00:00 2001
From: Daniel Leidert <dleidert@debian.org>
Date: Mon, 22 Nov 2021 01:34:25 +0100
Subject: [PATCH] Properly accept argument and keywords
---
lib/flexmock/composite_expectation.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/flexmock/composite_expectation.rb b/lib/flexmock/composite_expectation.rb
index 370046f..fbc8e54 100644
--- a/lib/flexmock/composite_expectation.rb
+++ b/lib/flexmock/composite_expectation.rb
@@ -16,9 +16,9 @@ def add(expectation)
end
# Apply the constraint method to all expectations in the composite.
- def method_missing(sym, *args, &block)
+ def method_missing(sym, *args, **keywords, &block)
@expectations.each do |expectation|
- expectation.send(sym, *args, &block)
+ expectation.send(sym, *args, **keywords, &block)
end
self
end

View File

@@ -0,0 +1,25 @@
From b3a2d7984803d70778c1f585ca48fb1fd374e44c Mon Sep 17 00:00:00 2001
From: Daniel Leidert <dleidert@debian.org>
Date: Mon, 22 Nov 2021 01:34:48 +0100
Subject: [PATCH] Use binding.source_location for test
Fixes the warning:
warning: __FILE__ in eval may not return location in binding; use Binding#source_location instead
---
test/test_helper.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 9eb3310..c4fd622 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -50,7 +50,7 @@ def assert_failure(klass, options={}, &block)
# added.
def assert_mock_failure(klass, options={}, &block)
ex = assert_failure(klass, options, &block)
- file = eval("__FILE__", block.binding)
+ file = block.binding.source_location.first
assert_matching_line(ex, file, options)
end

View File

@@ -0,0 +1,23 @@
From 8a4be2142b37a6ab4b6b8a3f38a07f2b06752acf Mon Sep 17 00:00:00 2001
From: Daniel Leidert <dleidert@debian.org>
Date: Mon, 22 Nov 2021 01:35:53 +0100
Subject: [PATCH] Relax error message on test a bit
---
test/partial_mock_test.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/test/partial_mock_test.rb b/test/partial_mock_test.rb
index 065ecb5..3564db3 100644
--- a/test/partial_mock_test.rb
+++ b/test/partial_mock_test.rb
@@ -634,7 +634,8 @@ def test_partial_mocks_leaves_NoMethodError_exceptions_raised_by_the_original_me
exception = assert_raises(NameError) do
obj.mocked_method
end
- assert_equal "undefined method `does_not_exist' for #{obj}", exception.message
+ assert(/undefined method `does_not_exist' for #<#<Class:/ === exception.message,
+ "expected #{exception.message} to match /undefined method `does_not_exist' for #<#<Class:/")
end
def test_it_checks_whether_mocks_are_forbidden_before_forwarding_the_call

View File

@@ -0,0 +1,44 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
USE_RUBY="ruby27 ruby30 ruby31 ruby32"
RUBY_FAKEGEM_DOCDIR="html"
RUBY_FAKEGEM_EXTRADOC="CHANGES README.md doc/*.rdoc doc/releases/*"
RUBY_FAKEGEM_RECIPE_TEST="none"
RUBY_FAKEGEM_RECIPE_DOC="none"
RUBY_FAKEGEM_GEMSPEC="flexmock.gemspec"
inherit ruby-fakegem
DESCRIPTION="Simple mock object library for Ruby unit testing"
HOMEPAGE="https://github.com/doudou/flexmock"
SRC_URI="https://github.com/doudou/flexmock/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="flexmock"
SLOT="0"
KEYWORDS="~amd64 ~arm ~hppa ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
IUSE=""
PATCHES=( "${FILESDIR}"/flexmock-2.3.6-ruby30-{1,2,3}.patch )
ruby_add_bdepend "
test? (
dev-ruby/minitest:5
dev-ruby/rspec:3
)"
each_ruby_test() {
RSPEC_VERSION=3 ruby-ng_rspec test/rspec_integration
${RUBY} -Ilib:.:test -e 'Dir["test/*_test.rb"].each{|f| require f}' || die
}
all_ruby_prepare() {
sed -i -e '1igem "minitest", "~>5.0"' test/test_helper.rb || die
sed -i -e 's/git ls-files -z/find * -print0/' ${RUBY_FAKEGEM_GEMSPEC} || die
}