Subject: [bug#62196] [PATCH 134/223] gnu: Add ruby-capybara.

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

* gnu/packages/ruby.scm (ruby-capybara): New variable.
---

 gnu/packages/ruby.scm | 48 +++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 46 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 13d299fd3c..97ed984811 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -1664,8 +1664,7 @@ (define-public ruby-rubocop-capybara
   (package
     (inherit ruby-rubocop-capybara-minimal)
     (arguments
-     (list #:tests? #t
-           #:test-target "spec"
+     (list #:test-target "spec"
            #:phases #~(modify-phases %standard-phases
                         (add-after 'unpack 'relax-requirements
                           (lambda _
@@ -11997,6 +11996,51 @@ (define-public ruby-cabin
     (home-page "https://github.com/jordansissel/ruby-cabin")
     (license license:asl2.0)))
 
+(define-public ruby-capybara
+  (package
+    (name "ruby-capybara")
+    (version "3.38.0")
+    (source (origin
+              (method url-fetch)
+              (uri (rubygems-uri "capybara" version))
+              (sha256
+               (base32
+                "123198zk2ak8mziwa5jc3ckgpmsg08zn064n3aywnqm9s1bwjv3v"))))
+    (build-system ruby-build-system)
+    (arguments
+     (list #:tests? #f                ;sinatra is currently broken with rack 3
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'extract-gemspec 'remove-extraneous-requirements
+                 (lambda _
+                   (substitute* "spec/spec_helper.rb"
+                     ((".*require 'selenium_statistics'.*") "")
+                     ((".*SeleniumStatistics.print_results.*") ""))))
+               (replace 'check
+                 (lambda* (#:key tests? #:allow-other-keys)
+                   (when tests?
+                     (invoke "rspec" "spec")))))))
+    (native-inputs
+     (list ruby-puma
+           ruby-rspec
+           ruby-selenium-webdriver
+           ruby-sinatra))
+    (propagated-inputs
+     (list ruby-addressable
+           ruby-launchy
+           ruby-matrix
+           ruby-mini-mime
+           ruby-nokogiri
+           ruby-rack
+           ruby-rack-test
+           ruby-regexp-parser
+           ruby-xpath))
+    (synopsis "Integration testing tool for rack-based web applications")
+    (description "Capybara is an integration testing tool for rack based web
+applications.  It simulates how a user would interact with a website.")
+    (home-page "https://github.com/teamcapybara/capybara")
+    (license license:expat)))
+
 (define-public ruby-cane
   (package
     (name "ruby-cane")
-- 
2.39.1