Subject: [bug#62196] [PATCH 206/223] gnu: ruby-oauth2: Update to 2.0.9 and enable tests.

From: Maxim Cournoyer <[email-masked]>
Date: Mon, 20 Mar 2023 13:29:16 -0400

* gnu/packages/ruby.scm (ruby-oauth2): Update to 2.0.9.
[arguments]: Enable tests.  Add #:phases.
[native-inputs]: New field.
[propagated-inputs]: Add ruby-snaky-hash.
---

 gnu/packages/ruby.scm | 49 ++++++++++++++++++++++++++++++++++---------
 1 file changed, 39 insertions(+), 10 deletions(-)

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 87b78f7d2b..117f6fa789 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -2626,19 +2626,48 @@ (define-public ruby-saikuro-treemap
 (define-public ruby-oauth2
   (package
     (name "ruby-oauth2")
-    (version "1.4.2")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (rubygems-uri "oauth2" version))
-       (sha256
-        (base32 "15i9z4j5pcjkr30lkcd79xzbr4kpmy0bqgwa436fqyqk646fv036"))))
+    (version "2.0.9")
+    (source (origin
+              (method git-fetch)        ;for tests
+              (uri (git-reference
+                    (url "https://gitlab.com/oauth-xx/oauth2")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "191j1f4gjw8wij1jy2fvddgi8cv1mm0ki7v0b0795clix1avnj29"))))
     (build-system ruby-build-system)
     (arguments
-     '(#:tests? #f))                    ; no included tests
+     (list #:phases #~(modify-phases %standard-phases
+                        (add-after 'unpack 'relax-requirements
+                          (lambda _
+                            (substitute* "Gemfile"
+                              (("^linting = .*")
+                               "linting = false\n")
+                              (("^coverage = .*")
+                               "coverage = false\n")
+                              (("^debug = .*")
+                               "debug = false\n"))
+                            (substitute* "spec/spec_helper.rb"
+                              (("^RUN_COVERAGE = .*")
+                               "RUN_COVERAGE = false\n")
+                              (("^ALL_FORMATTERS = .*")
+                               "ALL_FORMATTERS = false\n")))))))
+    (native-inputs
+     (list ruby-addressable
+           ruby-backports
+           ruby-rexml
+           ruby-rspec-block-is-expected
+           ruby-rspec-pending-for
+           ruby-rspec-stubbed-env
+           ruby-silent-stream))
     (propagated-inputs
-     (list ruby-faraday ruby-jwt ruby-multi-json ruby-multi-xml
-           ruby-rack))
+     (list ruby-faraday
+           ruby-jwt
+           ruby-multi-json
+           ruby-multi-xml
+           ruby-rack
+           ruby-snaky-hash))
     (synopsis "Ruby wrapper for the OAuth 2.0")
     (description
      "This package provides a Ruby wrapper for the OAuth 2.0 protocol built
-- 
2.39.1