From 11095cf22b5261af45fb201adb60e9489f6915a2 Mon Sep 17 00:00:00 2001 From: ulferts Date: Wed, 12 Mar 2025 09:51:24 +0100 Subject: [PATCH] use rails 5.1 defaults --- config/application.rb | 4 ++-- .../new_framework_defaults_5_1.rb | 19 ------------------- .../new_framework_defaults_6_1.rb | 6 ++++++ .../spec/views/base.html.erb_spec.rb | 5 +++-- 4 files changed, 11 insertions(+), 23 deletions(-) delete mode 100644 config/initializers/new_framework_defaults_5_1.rb diff --git a/config/application.rb b/config/application.rb index 97f4e8f0c83..96a9d57ae79 100644 --- a/config/application.rb +++ b/config/application.rb @@ -54,10 +54,10 @@ module OpenProject # https://guides.rubyonrails.org/configuring.html#versioned-default-values # for the default values associated with a particular version. # - # Goal is to reach 7.0 defaults. Overridden defaults should be stored in + # Goal is to reach 8.0 defaults. Overridden defaults should be stored in # specific initializers files. See # https://community.openproject.org/wp/45463 for details. - config.load_defaults 5.0 + config.load_defaults 5.1 # Please, add to the `ignore` list any other `lib` subdirectories that do # not contain `.rb` files, or that should not be reloaded or eager loaded. diff --git a/config/initializers/new_framework_defaults_5_1.rb b/config/initializers/new_framework_defaults_5_1.rb deleted file mode 100644 index c04995393b4..00000000000 --- a/config/initializers/new_framework_defaults_5_1.rb +++ /dev/null @@ -1,19 +0,0 @@ -# Be sure to restart your server when you modify this file. -# -# This file contains migration options to ease your Rails 5.1 upgrade. -# -# Once upgraded flip defaults one by one to migrate to the new default. -# -# Read the Guide for Upgrading Ruby on Rails for more info on each option. - -# https://guides.rubyonrails.org/configuring.html#config-action-view-form-with-generates-remote-forms -# Make `form_with` generate non-remote forms. Previous versions had false. -# Rails 5.1, 5.2, and 6.0 default is true. Rails 6.1+ default is false. -# Let's keep it false as it is the definitive default -# Rails.application.config.action_view.form_with_generates_remote_forms = true - -# https://guides.rubyonrails.org/configuring.html#config-assets-unknown-asset-fallback -# Unknown asset fallback will return the path passed in when the given -# asset is not present in the asset pipeline. Previous versions had true. -# Rails 5.1+ default is false. -# Rails.application.config.assets.unknown_asset_fallback = false diff --git a/config/initializers/new_framework_defaults_6_1.rb b/config/initializers/new_framework_defaults_6_1.rb index d2690c55a98..978d9162e15 100644 --- a/config/initializers/new_framework_defaults_6_1.rb +++ b/config/initializers/new_framework_defaults_6_1.rb @@ -93,3 +93,9 @@ # preloading assets when using `javascript_include_tag` and `stylesheet_link_tag`. # Previous versions had false. Rails 6.1+ default is true. # Rails.application.config.action_view.preload_links_header = true + +# Copied from 5.1 to keep the value to false even with the defaults of 5.1 being activated. +# https://guides.rubyonrails.org/configuring.html#config-action-view-form-with-generates-remote-forms +# Make `form_with` generate non-remote forms. Previous versions had false. +# Rails 5.1, 5.2, and 6.0 default is true. Rails 6.1+ default is false. +Rails.application.config.action_view.form_with_generates_remote_forms = false diff --git a/modules/auth_plugins/spec/views/base.html.erb_spec.rb b/modules/auth_plugins/spec/views/base.html.erb_spec.rb index 435ad7199fd..4778e32fb69 100644 --- a/modules/auth_plugins/spec/views/base.html.erb_spec.rb +++ b/modules/auth_plugins/spec/views/base.html.erb_spec.rb @@ -44,7 +44,8 @@ RSpec.describe "layouts/base" do context "with an authenticator with given icon" do let(:provider) do - { name: "foob_auth", icon: "image.png" } + # Need to use an actually existing image as the asset pipeline will otherwise not include the link. + { name: "foob_auth", icon: "openid_connect/auth_provider-custom.png" } end before do @@ -52,7 +53,7 @@ RSpec.describe "layouts/base" do end it "adds the CSS to render the icon" do - expect(rendered).to have_text(/background-image:(?:.*)image.png/) + expect(rendered).to have_text(/background-image:(?:.*)auth_provider-custom.png/) end end end