public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/ruby] main: Add support for patch version in Rails
@ 2026-09-09 13:26 
  0 siblings, 0 replies; only message in thread
From:  @ 2026-09-09 13:26 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : tests/ruby
            Branch : main
            Commit : 935a2a0d1ddd5a1bba576781e6b56e66a3db62a0
            Author : Vít Ondruch <vondruch@redhat.com>
            Date   : 2026-09-09T15:09:01+02:00
            Stats  : +5/-1 in 1 file(s)
            URL    : https://src.fedoraproject.org/tests/ruby/c/935a2a0d1ddd5a1bba576781e6b56e66a3db62a0?branch=main

            Log:
            Add support for patch version in Rails

Currently, the test fails with the following error:

~~~
... snip ...

:: [ 17:58:30 ] :: [   PASS   ] :: Creating new rails application (Expected 0, got 0)
:: [ 17:58:30 ] :: [  BEGIN   ] :: Running 'pushd app/'
/tmp/tmp.QUuaPCQMYg/app /tmp/tmp.QUuaPCQMYg /var/ARTIFACTS/work-all5lab20yf/plans/all/discover/default-0/tests/run-basic-rails-application
:: [ 17:58:30 ] :: [   PASS   ] :: Command 'pushd app/' (Expected 0, got 0)
:: [ 17:58:30 ] :: [   PASS   ] :: Directory app should exist
:: [ 17:58:30 ] :: [  BEGIN   ] :: Updating Gemfile to ensure Rails RPM version is used :: actually running 'sed -i.orig -E -e '/^gem "rails"/ s/~> //' Gemfile'
:: [ 17:58:30 ] :: [   PASS   ] :: Updating Gemfile to ensure Rails RPM version is used (Expected 0, got 0)
:: [ 17:58:30 ] :: [  BEGIN   ] :: Printing the Gemfile modifications :: actually running 'diff Gemfile.orig Gemfile'
STDOUT: 4c4
STDOUT: < gem "rails", "~> 8.1.3", ">= 8.1.3.1"
STDOUT: ---
STDOUT: > gem "rails", "8.1.3", ">= 8.1.3.1"
:: [ 17:58:30 ] :: [   PASS   ] :: Printing the Gemfile modifications (Expected 1, got 1)
:: [ 17:58:30 ] :: [  BEGIN   ] :: Installing dependencies specified in Gemfile :: actually running 'bundle install'
Don't run Bundler as root. Installing your bundle as root will break this
application for all non-root users on this machine.
Fetching gem metadata from https://rubygems.org/..........
Local specification for nokogiri-1.19.4 has different dependencies than the remote gem, ignoring it
Local specification for activesupport-8.1.3.1 has different dependencies than the remote gem, ignoring it
Could not find gem 'rails (= 8.1.3, >= 8.1.3.1)' in rubygems repository

... snip ...
~~~

The issue here is that there are two possible variants of `gem "rails"`
depeindency, as can be seen here:

https://github.com/rails/rails/blob/main/railties/lib/rails/generators/app_base.rb#L482-L493

This fixes the test to always end up with the hard dependency, such as:

~~~
gem "rails", "8.1.3.1"
~~~

Resolves: rhbz#2530704

---
diff --git a/run-basic-rails-application/runtest.sh b/run-basic-rails-application/runtest.sh
index 200fd1a..1c7cc36 100755
--- a/run-basic-rails-application/runtest.sh
+++ b/run-basic-rails-application/runtest.sh
@@ -46,7 +46,11 @@ rlJournalStart
         rlRun "rails new app --skip-bundle" 0 "Creating new rails application"
         rlRun "pushd app/"
         rlAssertExists "app"
-        rlRun "sed -i.orig -E -e '/^gem \"rails\"/ s/~> //' Gemfile" 0 \
+        # There are two variants of the `gem "rails"` line:
+        # https://github.com/rails/rails/blob/main/railties/lib/rails/generators/app_base.rb#L482-L493
+        rlRun "sed -i.orig -E \
+            -e '/^gem \"rails\"/ s/\"~> [^\"]+\", \">= ([^\"]+)\"/\"\1\"/' \
+            -e '/^gem \"rails\"/ s/~> //' Gemfile" 0 \
             "Updating Gemfile to ensure Rails RPM version is used"
         rlRun -t "diff Gemfile.orig Gemfile" 1 \
             "Printing the Gemfile modifications"

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-09 13:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-09 13:26 [tests/ruby] main: Add support for patch version in Rails 

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox