GNU bug report logs - #74201
[PATCH] gnu: ruby-ethon: Enable tests.

Previous Next

Package: guix-patches;

Reported by: gemmaro <gemmaro.dev <at> gmail.com>

Date: Mon, 4 Nov 2024 07:16:02 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: gemmaro <gemmaro.dev <at> gmail.com>
To: 74201 <at> debbugs.gnu.org
Cc: gemmaro <gemmaro.dev <at> gmail.com>, Christopher Baines <guix <at> cbaines.net>
Subject: [bug#74201] [PATCH] gnu: ruby-ethon: Enable tests.
Date: Mon,  4 Nov 2024 16:14:28 +0900
* gnu/packages/ruby.scm (ruby-ethon): Enable tests.
[source]: Switch to use the Git repository, which includes test files.
[arguments]<#:tests?>: Remove it to enable tests by default.
<#:phases>: Add a phase to relax the mime-types gem version constraint.
Add a phase to remove Bundler setup, and replace the check phase to directly
run RSpec, in order to avoid perf dependencies.
Because of this, #:test-target is not needed to be "spec".
[native-inputs]: Add test dependencies.

Change-Id: Ie46d682ccb5e9b5048a109cd8587e2178c34f8ec
---
 gnu/packages/ruby.scm | 32 +++++++++++++++++++++++++++-----
 1 file changed, 27 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 12c439b3a9..3f0d32e8b5 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -3082,22 +3082,44 @@ (define-public ruby-ethon
     (version "0.12.0")
     (source
      (origin
-       (method url-fetch)
-       (uri (rubygems-uri "ethon" version))
+       (method git-fetch) ;for tests
+       (uri (git-reference
+             (url "https://github.com/typhoeus/ethon")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
        (sha256
         (base32
-         "0gggrgkcq839mamx7a8jbnp2h7x2ykfn34ixwskwb0lzx2ak17g9"))))
+         "0f29h4slja66kkc675rk4nnsxzhlgb143whx4ffx250w36ih0aq3"))))
     (build-system ruby-build-system)
     (arguments
      (list
-      #:tests? #f  ; no included tests
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'libcurl-use-absolute-reference
             (lambda* (#:key inputs #:allow-other-keys)
               (substitute* "lib/ethon/curls/settings.rb"
                 (("libcurl', 'libcurl\\.so\\.4")
-                 (search-input-file inputs "/lib/libcurl.so"))))))))
+                 (search-input-file inputs "/lib/libcurl.so")))))
+          (add-after 'extract-gemspec 'remove-MIME-types-version-constraint
+            (lambda _
+              (substitute* "Gemfile"
+                (("(gem \"mime-types\").*" _ gem)
+                 gem))))
+
+          ;; Tell Bundler not to request perf dependencies
+          (add-after 'extract-gemspec 'remove-Bundler-setup
+            (lambda _
+              (substitute* "spec/spec_helper.rb"
+                (("Bundler.setup")
+                 ""))))
+          (replace 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (for-each (lambda (file)
+                            (invoke "ruby" "-Ispec" file))
+                          (find-files "spec" "_spec\\.rb$"))))))))
+    (native-inputs (list ruby-rspec ruby-sinatra ruby-mustermann
+                         ruby-mime-types ruby-webrick))
     (inputs
      (list curl))
     (propagated-inputs

base-commit: 547d97180471e90e404a948015f65431961aa273
-- 
2.46.0





This bug report was last modified 226 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.