summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2020-05-20 19:11:16 +0200
committerMarius Bakke <mbakke@fastmail.com>2020-05-20 23:51:26 +0200
commit96bf7521e0918b055a2e9fa7a09183f04c97165b (patch)
treec52f6a64d3182df8c2d325e057a45786bc466fbe
parent2156cc9cd60e8adde475e25f45128e324ea9dff3 (diff)
downloadguix-96bf7521e0918b055a2e9fa7a09183f04c97165b.tar.gz
gnu: Add ruby-forking-test-runner.
* gnu/packages/ruby.scm (ruby-forking-test-runner): New public variable.
-rw-r--r--gnu/packages/ruby.scm51
1 files changed, 51 insertions, 0 deletions
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 363ee8546c..70ed0dfd0f 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -1884,6 +1884,57 @@ libraries such as Libnotify.")
     (home-page "https://github.com/guard/notiffany")
     (license license:expat)))
 
+(define-public ruby-forking-test-runner
+  (package
+    (name "ruby-forking-test-runner")
+    (version "1.6.0")
+    (home-page "https://github.com/grosser/forking_test_runner")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference (url home-page)
+                                  (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1mrglzkj2nrgisccf2f30zbfmcs0awv1g3lw994b2az90fl39x8m"))))
+    (build-system ruby-build-system)
+    (arguments
+     '(#:test-target "spec"
+       ;; FIXME: ActiveRecord depends on sqlite3 1.3.6, but Guix has
+       ;; 1.4.1, which in turn breaks the tests that use ActiveRecord.
+       #:tests? #f
+       #:phases (modify-phases %standard-phases
+                  (replace 'replace-git-ls-files
+                    (lambda _
+                      (substitute* "forking_test_runner.gemspec"
+                        (("`git ls-files lib/ bin/ MIT-LICENSE`")
+                         "`find lib/ bin/ MIT-LICENSE -type f | sort`"))
+                      #t))
+                  (add-before 'check 'remove-version-constraints
+                    (lambda _
+                      ;; Ignore hard coded version constraints for the tests.
+                      (delete-file "Gemfile.lock")
+                      #t))
+                  (add-before 'check 'set-HOME
+                    (lambda _
+                      ;; Many tests invoke Bundler, and fails when Bundler
+                      ;; warns that /homeless-shelter does not exist.
+                      (setenv "HOME" "/tmp")
+                      #t)))))
+    (native-inputs
+     `(("ruby-activerecord" ,ruby-activerecord)
+       ("ruby-bump" ,ruby-bump)
+       ("ruby-rspec" ,ruby-rspec)
+       ("ruby-sqlite3" ,ruby-sqlite3)
+       ("ruby-wwtd" ,ruby-wwtd)))
+    (propagated-inputs
+     `(("ruby-parallel-tests" ,ruby-parallel-tests)))
+    (synopsis "Run every test in a fork")
+    (description
+     "This package is a wrapper around @code{parallel_tests} that runs every
+test in a fork to avoid pollution and get clean output per test.")
+    (license license:expat)))
+
 (define-public ruby-formatador
   (package
     (name "ruby-formatador")