commit:     4752060b39b25ee94669267dc89ae689f83f1286
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 22 06:58:52 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Mar 22 07:35:10 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4752060b

dev-ruby/simplecov: enable ruby32 (w/ fixed tests)

This test is only activated for >= ruby32 because ruby32 adds support
for assessing coverage within an eval. But the failure isn't anything
to do with eval.

The test tries to call 'ruby' which in Gentoo isn't (yet!) wrapped,
so it ends up calling an older Ruby which then results in 0 coverage
being found. Replace it with a string we can safely sed with the
correct Ruby per-test.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/simplecov-0.22.0-ruby32-gentoo.patch        | 19 +++++++++++++++++++
 dev-ruby/simplecov/simplecov-0.22.0.ebuild            | 13 ++++++++-----
 2 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/dev-ruby/simplecov/files/simplecov-0.22.0-ruby32-gentoo.patch 
b/dev-ruby/simplecov/files/simplecov-0.22.0-ruby32-gentoo.patch
new file mode 100644
index 000000000000..293fbe51d747
--- /dev/null
+++ b/dev-ruby/simplecov/files/simplecov-0.22.0-ruby32-gentoo.patch
@@ -0,0 +1,19 @@
+This test is only activated for >= ruby32 because ruby32 adds support
+for assessing coverage within an eval. But the failure isn't anything
+to do with eval.
+
+The test tries to call 'ruby' which in Gentoo isn't (yet!) wrapped,
+so it ends up calling an older Ruby which then results in 0 coverage
+being found. Replace it with a string we can safely sed with the
+correct Ruby per-test.
+--- a/spec/coverage_for_eval_spec.rb
++++ b/spec/coverage_for_eval_spec.rb
+@@ -16,7 +16,7 @@ RSpec.describe "coverage for eval" do
+     end
+ 
+     context "foo" do
+-      let(:command) { "ruby eval_test.rb" }
++      let(:command) { "@GENTOO_RUBY@ eval_test.rb" }
+ 
+       it "records coverage for erb" do
+         expect(@stdout).to include(" 2 / 3 LOC")

diff --git a/dev-ruby/simplecov/simplecov-0.22.0.ebuild 
b/dev-ruby/simplecov/simplecov-0.22.0.ebuild
index 1f2ded59ddcd..22e7cc4d0130 100644
--- a/dev-ruby/simplecov/simplecov-0.22.0.ebuild
+++ b/dev-ruby/simplecov/simplecov-0.22.0.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
 
-USE_RUBY="ruby27 ruby30 ruby31"
+USE_RUBY="ruby27 ruby30 ruby31 ruby32"
 
 RUBY_FAKEGEM_EXTRADOC="CHANGELOG.md README.md"
 
@@ -36,6 +36,10 @@ ruby_add_bdepend "test? (
 
 # There are also cucumber tests that require poltergeist and unpackaged 
phantomjs gem.
 
+PATCHES=(
+       "${FILESDIR}"/${PN}-0.22.0-ruby32-gentoo.patch
+)
+
 all_ruby_prepare() {
        # Avoid test depending on spawning ruby and having timing issues
        sed -i -e '/blocks other processes/askip "gentoo"' 
spec/result_merger_spec.rb || die
@@ -48,7 +52,6 @@ all_ruby_prepare() {
 }
 
 each_ruby_test() {
-       RSPEC_VERSION=3 ruby-ng_rspec spec/*spec.rb || die
-
-       #${RUBY} -S cucumber features || die
+       sed -i -e "s:@GENTOO_RUBY@:${RUBY}:" spec/coverage_for_eval_spec.rb || 
die
+       RSPEC_VERSION=3 ruby-ng_rspec spec/ || die
 }

Reply via email to