summary refs log tree commit diff
path: root/gnu/packages/rails.scm
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-03-08 00:09:21 -0500
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-03-28 22:22:18 -0400
commit39f41cf93a87a94695f83372e590efab3b712230 (patch)
tree8241fcd8257d241fc36e80c2721f969b35c757f5 /gnu/packages/rails.scm
parent7c461b2ee9ddecf53944de6623fb1458b08e1c7f (diff)
downloadguix-39f41cf93a87a94695f83372e590efab3b712230.tar.gz
gnu: ruby-activerecord: Update to 7.0.4.3 and enable tests.
* gnu/packages/rails.scm (ruby-activerecord): Update to 7.0.4.3.
[source]: Use ruby-rails-monorepo.
[arguments]: Remove #:tests? argument.  Add #:phases argument.
[native-inputs]: New field.
[propagated-inputs]: Remove ruby-arel.  Add ruby-sqlite3.
Diffstat (limited to 'gnu/packages/rails.scm')
-rw-r--r--gnu/packages/rails.scm55
1 files changed, 35 insertions, 20 deletions
diff --git a/gnu/packages/rails.scm b/gnu/packages/rails.scm
index 329bacdaef..4dc9392201 100644
--- a/gnu/packages/rails.scm
+++ b/gnu/packages/rails.scm
@@ -287,27 +287,42 @@ serialization, internationalization, and testing.")
 
 (define-public ruby-activerecord
   (package
-   (name "ruby-activerecord")
-   (version "6.1.3")
-   (source
-    (origin
-     (method url-fetch)
-     (uri (rubygems-uri "activerecord" version))
-     (sha256
-      (base32
-       "03kr6vslwd9iw89jidjpjlp7prr2rf7kpsfa4fz03g9by0kliivs"))))
-   (build-system ruby-build-system)
-   (arguments
-    '(;; No included tests
-      #:tests? #f))
-   (propagated-inputs
-    (list ruby-activemodel ruby-activesupport ruby-arel))
-   (synopsis "Ruby library to connect to relational databases")
-   (description
-    "Active Record connects classes to relational database table to establish
+    (name "ruby-activerecord")
+    (version %ruby-rails-version)
+    (source ruby-rails-monorepo)
+    (build-system ruby-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'extract-gemspec 'chdir
+            (lambda _
+              (chdir "activerecord")))
+          (delete 'check)
+          (add-after 'install 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                ;; Avoid running the database tests, which require railties
+                ;; and/or database servers.
+                (invoke "ruby" "-Itest" "test/cases/base_test.rb"))))
+          (add-before 'check 'set-GEM_PATH
+            (lambda _
+              (setenv "GEM_PATH" (string-append
+                                  (getenv "GEM_PATH") ":"
+                                  #$output "/lib/ruby/vendor_ruby"))))
+          (add-before 'check 'check-setup
+            (lambda* (#:key native-inputs inputs #:allow-other-keys)
+              ;; A few tests require to set the timezone.
+              (setenv "TZDIR" (search-input-directory (or native-inputs inputs)
+                                                      "share/zoneinfo")))))))
+    (native-inputs (list tzdata-for-tests))
+    (propagated-inputs (list ruby-activemodel ruby-activesupport ruby-sqlite3))
+    (synopsis "Ruby library to connect to relational databases")
+    (description
+     "Active Record connects classes to relational database table to establish
 an almost zero-configuration persistence layer for applications.")
-   (home-page "https://rubyonrails.org")
-   (license license:expat)))
+    (home-page "https://rubyonrails.org")
+    (license license:expat)))
 
 (define-public ruby-rspec-rails
   (package