diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index d2fc936..e8b758f 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -9,10 +9,6 @@ jobs:
strategy:
matrix:
versions:
- - { ruby: "3.0", rails: "6.1", rubygems: "default" }
- - { ruby: "3.1", rails: "6.1", rubygems: "default" }
- - { ruby: "3.2", rails: "6.1", rubygems: "default" }
- - { ruby: "3.3", rails: "6.1", rubygems: "default" }
- { ruby: "3.0", rails: "7.0", rubygems: "default" }
- { ruby: "3.1", rails: "7.0", rubygems: "default" }
- { ruby: "3.2", rails: "7.0", rubygems: "default" }
diff --git a/Appraisals b/Appraisals
index e473498..960b0b5 100644
--- a/Appraisals
+++ b/Appraisals
@@ -1,14 +1,5 @@
# frozen_string_literal: true
-appraise "rails-6.1_vc-2.0" do
- gem "rails", "~> 6.1.0"
-end
-
-appraise "rails-6.1_vc-3.0" do
- gem "rails", "~> 6.1.0"
- gem "view_component", ">= 3.0.0", "< 4.0"
-end
-
appraise "rails-7.0_vc-2.0" do
gem "rails", "~> 7.0.0"
end
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4ec7bcf..66135a8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,7 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
-Nothing yet.
+### Removed
+- Drop Rails 6.1 support
## [0.2.9] - 2024-11-09
### Added
diff --git a/Gemfile b/Gemfile
index 23ae7ca..86f07b8 100644
--- a/Gemfile
+++ b/Gemfile
@@ -19,3 +19,6 @@ gem "rubocop-performance", require: false
gem "rubocop-rspec", require: false
gem "simplecov", require: false, group: :test
gem "sqlite3", "~> 1.4", group: :test
+
+# Temporarilly fi for "uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger" error
+gem "concurrent-ruby", "!= 3.1.5"
diff --git a/Gemfile.lock b/Gemfile.lock
index ef28a6f..1675b49 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -10,83 +10,77 @@ PATH
GEM
remote: https://rubygems.org/
specs:
- actioncable (7.1.5.1)
- actionpack (= 7.1.5.1)
- activesupport (= 7.1.5.1)
+ actioncable (8.0.1)
+ actionpack (= 8.0.1)
+ activesupport (= 8.0.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
- actionmailbox (7.1.5.1)
- actionpack (= 7.1.5.1)
- activejob (= 7.1.5.1)
- activerecord (= 7.1.5.1)
- activestorage (= 7.1.5.1)
- activesupport (= 7.1.5.1)
- mail (>= 2.7.1)
- net-imap
- net-pop
- net-smtp
- actionmailer (7.1.5.1)
- actionpack (= 7.1.5.1)
- actionview (= 7.1.5.1)
- activejob (= 7.1.5.1)
- activesupport (= 7.1.5.1)
- mail (~> 2.5, >= 2.5.4)
- net-imap
- net-pop
- net-smtp
+ actionmailbox (8.0.1)
+ actionpack (= 8.0.1)
+ activejob (= 8.0.1)
+ activerecord (= 8.0.1)
+ activestorage (= 8.0.1)
+ activesupport (= 8.0.1)
+ mail (>= 2.8.0)
+ actionmailer (8.0.1)
+ actionpack (= 8.0.1)
+ actionview (= 8.0.1)
+ activejob (= 8.0.1)
+ activesupport (= 8.0.1)
+ mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
- actionpack (7.1.5.1)
- actionview (= 7.1.5.1)
- activesupport (= 7.1.5.1)
+ actionpack (8.0.1)
+ actionview (= 8.0.1)
+ activesupport (= 8.0.1)
nokogiri (>= 1.8.5)
- racc
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
- actiontext (7.1.5.1)
- actionpack (= 7.1.5.1)
- activerecord (= 7.1.5.1)
- activestorage (= 7.1.5.1)
- activesupport (= 7.1.5.1)
+ useragent (~> 0.16)
+ actiontext (8.0.1)
+ actionpack (= 8.0.1)
+ activerecord (= 8.0.1)
+ activestorage (= 8.0.1)
+ activesupport (= 8.0.1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
- actionview (7.1.5.1)
- activesupport (= 7.1.5.1)
+ actionview (8.0.1)
+ activesupport (= 8.0.1)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
- activejob (7.1.5.1)
- activesupport (= 7.1.5.1)
+ activejob (8.0.1)
+ activesupport (= 8.0.1)
globalid (>= 0.3.6)
- activemodel (7.1.5.1)
- activesupport (= 7.1.5.1)
- activerecord (7.1.5.1)
- activemodel (= 7.1.5.1)
- activesupport (= 7.1.5.1)
+ activemodel (8.0.1)
+ activesupport (= 8.0.1)
+ activerecord (8.0.1)
+ activemodel (= 8.0.1)
+ activesupport (= 8.0.1)
timeout (>= 0.4.0)
- activestorage (7.1.5.1)
- actionpack (= 7.1.5.1)
- activejob (= 7.1.5.1)
- activerecord (= 7.1.5.1)
- activesupport (= 7.1.5.1)
+ activestorage (8.0.1)
+ actionpack (= 8.0.1)
+ activejob (= 8.0.1)
+ activerecord (= 8.0.1)
+ activesupport (= 8.0.1)
marcel (~> 1.0)
- activesupport (7.1.5.1)
+ activesupport (8.0.1)
base64
benchmark (>= 0.3)
bigdecimal
- concurrent-ruby (~> 1.0, >= 1.0.2)
+ concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
- mutex_m
securerandom (>= 0.3)
- tzinfo (~> 2.0)
+ tzinfo (~> 2.0, >= 2.0.5)
+ uri (>= 0.13.1)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
appraisal (2.5.0)
@@ -96,7 +90,7 @@ GEM
ast (2.4.2)
base64 (0.2.0)
benchmark (0.4.0)
- bigdecimal (3.1.8)
+ bigdecimal (3.1.9)
builder (3.3.0)
capybara (3.40.0)
addressable
@@ -112,28 +106,29 @@ GEM
railties (>= 3.0.0)
thor (>= 0.14.6)
concurrent-ruby (1.3.4)
- connection_pool (2.4.1)
+ connection_pool (2.5.0)
crass (1.0.6)
date (3.4.1)
diff-lcs (1.5.1)
docile (1.4.1)
drb (2.2.1)
- erubi (1.13.0)
+ erubi (1.13.1)
generator_spec (0.10.0)
activesupport (>= 3.0.0)
railties (>= 3.0.0)
globalid (1.2.1)
activesupport (>= 6.1)
- i18n (1.14.6)
+ i18n (1.14.7)
concurrent-ruby (~> 1.0)
io-console (0.8.0)
- irb (1.14.1)
+ irb (1.15.1)
+ pp (>= 0.6.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
- json (2.9.0)
- language_server-protocol (3.17.0.3)
- logger (1.6.2)
- loofah (2.23.1)
+ json (2.9.1)
+ language_server-protocol (3.17.0.4)
+ logger (1.6.5)
+ loofah (2.24.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mail (2.8.1)
@@ -147,8 +142,7 @@ GEM
mini_mime (1.1.5)
mini_portile2 (2.8.8)
minitest (5.25.4)
- mutex_m (0.3.0)
- net-imap (0.4.18)
+ net-imap (0.5.5)
date
net-protocol
net-pop (0.1.2)
@@ -158,64 +152,68 @@ GEM
net-smtp (0.5.0)
net-protocol
nio4r (2.7.4)
- nokogiri (1.17.1)
+ nokogiri (1.18.2)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
- nokogiri (1.17.1-x86_64-darwin)
+ nokogiri (1.18.2-x86_64-darwin)
racc (~> 1.4)
- nokogiri (1.17.1-x86_64-linux)
+ nokogiri (1.18.2-x86_64-linux-gnu)
racc (~> 1.4)
parallel (1.26.3)
- parser (3.3.6.0)
+ parser (3.3.7.0)
ast (~> 2.4.1)
racc
- psych (5.2.1)
+ pp (0.6.2)
+ prettyprint
+ prettyprint (0.2.0)
+ psych (5.2.3)
date
stringio
public_suffix (6.0.1)
racc (1.8.1)
- rack (3.1.8)
- rack-session (2.0.0)
+ rack (3.1.9)
+ rack-session (2.1.0)
+ base64 (>= 0.1.0)
rack (>= 3.0.0)
- rack-test (2.1.0)
+ rack-test (2.2.0)
rack (>= 1.3)
rackup (2.2.1)
rack (>= 3)
- rails (7.1.5.1)
- actioncable (= 7.1.5.1)
- actionmailbox (= 7.1.5.1)
- actionmailer (= 7.1.5.1)
- actionpack (= 7.1.5.1)
- actiontext (= 7.1.5.1)
- actionview (= 7.1.5.1)
- activejob (= 7.1.5.1)
- activemodel (= 7.1.5.1)
- activerecord (= 7.1.5.1)
- activestorage (= 7.1.5.1)
- activesupport (= 7.1.5.1)
+ rails (8.0.1)
+ actioncable (= 8.0.1)
+ actionmailbox (= 8.0.1)
+ actionmailer (= 8.0.1)
+ actionpack (= 8.0.1)
+ actiontext (= 8.0.1)
+ actionview (= 8.0.1)
+ activejob (= 8.0.1)
+ activemodel (= 8.0.1)
+ activerecord (= 8.0.1)
+ activestorage (= 8.0.1)
+ activesupport (= 8.0.1)
bundler (>= 1.15.0)
- railties (= 7.1.5.1)
+ railties (= 8.0.1)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
- rails-html-sanitizer (1.6.1)
+ rails-html-sanitizer (1.6.2)
loofah (~> 2.21)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
- railties (7.1.5.1)
- actionpack (= 7.1.5.1)
- activesupport (= 7.1.5.1)
- irb
+ railties (8.0.1)
+ actionpack (= 8.0.1)
+ activesupport (= 8.0.1)
+ irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.2.1)
- rdoc (6.8.1)
+ rdoc (6.11.0)
psych (>= 4.0.0)
- regexp_parser (2.9.3)
- reline (0.5.12)
+ regexp_parser (2.10.0)
+ reline (0.6.0)
io-console (~> 0.5)
rspec (3.13.0)
rspec-core (~> 3.13.0)
@@ -232,34 +230,34 @@ GEM
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
- rspec-rails (6.1.3)
- actionpack (>= 6.1)
- activesupport (>= 6.1)
- railties (>= 6.1)
+ rspec-rails (7.1.0)
+ actionpack (>= 7.0)
+ activesupport (>= 7.0)
+ railties (>= 7.0)
rspec-core (~> 3.13)
rspec-expectations (~> 3.13)
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (3.13.2)
- rubocop (1.69.1)
+ rubocop (1.71.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
- rubocop-ast (>= 1.36.2, < 2.0)
+ rubocop-ast (>= 1.38.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
- rubocop-ast (1.36.2)
+ rubocop-ast (1.38.0)
parser (>= 3.3.1.0)
- rubocop-performance (1.21.1)
+ rubocop-performance (1.23.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
- rubocop-rspec (3.0.3)
+ rubocop-rspec (3.4.0)
rubocop (~> 1.61)
ruby-progressbar (1.13.0)
- securerandom (0.3.2)
+ securerandom (0.4.1)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
@@ -272,22 +270,25 @@ GEM
sqlite3 (1.7.3-x86_64-linux)
stringio (3.1.2)
thor (1.3.2)
- timeout (0.4.2)
+ timeout (0.4.3)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
- unicode-display_width (3.1.2)
+ unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
- view_component (3.20.0)
+ uri (1.0.2)
+ useragent (0.16.11)
+ view_component (3.21.0)
activesupport (>= 5.2.0, < 8.1)
concurrent-ruby (~> 1.0)
method_source (~> 1.0)
- websocket-driver (0.7.6)
+ websocket-driver (0.7.7)
+ base64
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
- zeitwerk (2.6.18)
+ zeitwerk (2.7.1)
PLATFORMS
ruby
@@ -298,6 +299,7 @@ DEPENDENCIES
appraisal
capybara
combustion (~> 1.3.7)
+ concurrent-ruby (!= 3.1.5)
generator_spec
rails
rake (~> 13.0)
diff --git a/README.md b/README.md
index 05c357b..cd92a99 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ Development of this gem is sponsored by:
This gem is tested on:
-- Rails 6.1+ (with or without ActionText)
+- Rails 7.0+ (with or without ActionText)
- Ruby 3.0+
## Installation
diff --git a/app/components/view_component/form/base_component.rb b/app/components/view_component/form/base_component.rb
index 9679cc2..70dc798 100644
--- a/app/components/view_component/form/base_component.rb
+++ b/app/components/view_component/form/base_component.rb
@@ -7,8 +7,6 @@ class << self
attr_accessor :default_options
end
- include ClassNamesHelper if Gem::Version.new(Rails::VERSION::STRING) < Gem::Version.new("6.1")
-
attr_reader :form, :object_name, :options
delegate :object, to: :form, allow_nil: true
diff --git a/app/components/view_component/form/field_component.rb b/app/components/view_component/form/field_component.rb
index 40021fb..3ab7891 100644
--- a/app/components/view_component/form/field_component.rb
+++ b/app/components/view_component/form/field_component.rb
@@ -32,18 +32,10 @@ def method_errors
.map(&:upcase_first)
end
- if Gem::Version.new(Rails::VERSION::STRING) >= Gem::Version.new("6.1")
- def method_errors?
- return false unless object_errors
+ def method_errors?
+ return false unless object_errors
- (object_errors.attribute_names & object_method_names).any?
- end
- else
- def method_errors?
- return false unless object_errors
-
- (object_errors.keys & object_method_names).any?
- end
+ (object_errors.attribute_names & object_method_names).any?
end
def value
diff --git a/app/components/view_component/form/file_field_component.rb b/app/components/view_component/form/file_field_component.rb
index 8c0adfe..9ac38e0 100644
--- a/app/components/view_component/form/file_field_component.rb
+++ b/app/components/view_component/form/file_field_component.rb
@@ -6,9 +6,7 @@ class FileFieldComponent < FieldComponent
self.tag_klass = ActionView::Helpers::Tags::FileField
def before_render
- if Gem::Version.new(Rails::VERSION::STRING) >= Gem::Version.new("7.0")
- @options = { include_hidden: multiple_file_field_include_hidden }.merge!(options)
- end
+ @options = { include_hidden: multiple_file_field_include_hidden }.merge!(options)
@options = convert_direct_upload_option_to_url(@options.dup)
super
diff --git a/app/components/view_component/form/weekday_select_component.rb b/app/components/view_component/form/weekday_select_component.rb
index 052377e..f5f1091 100644
--- a/app/components/view_component/form/weekday_select_component.rb
+++ b/app/components/view_component/form/weekday_select_component.rb
@@ -13,18 +13,14 @@ def initialize(form, object_name, method_name, options = {}, html_options = {})
set_html_options!
end
- def call # rubocop:disable Metrics/MethodLength
- if Rails::VERSION::MAJOR >= 7 # rubocop:disable Style/GuardClause
- ActionView::Helpers::Tags::WeekdaySelect.new(
- object_name,
- method_name,
- @view_context,
- options,
- html_options
- ).render
- else
- raise NotImplementedError, "#{self.class} is only available in Rails >= 7"
- end
+ def call
+ ActionView::Helpers::Tags::WeekdaySelect.new(
+ object_name,
+ method_name,
+ @view_context,
+ options,
+ html_options
+ ).render
end
protected
diff --git a/gemfiles/rails_6.1_vc_2.0.gemfile b/gemfiles/rails_6.1_vc_2.0.gemfile
deleted file mode 100644
index d9db5fb..0000000
--- a/gemfiles/rails_6.1_vc_2.0.gemfile
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file was generated by Appraisal
-
-source "https://rubygems.org"
-
-gem "appraisal", require: false
-gem "capybara", require: false
-gem "combustion", "~> 1.3.7"
-gem "generator_spec"
-gem "rails", "~> 6.1.0"
-gem "rake", "~> 13.0"
-gem "rspec", "~> 3.0", require: false
-gem "rspec-html-matchers"
-gem "rspec-rails", require: false
-gem "rubocop", require: false
-gem "rubocop-performance", require: false
-gem "rubocop-rspec", require: false
-gem "simplecov", require: false, group: :test
-gem "sqlite3", "~> 1.4", group: :test
-
-gemspec path: "../"
diff --git a/gemfiles/rails_6.1_vc_3.0.gemfile b/gemfiles/rails_6.1_vc_3.0.gemfile
deleted file mode 100644
index c1f1874..0000000
--- a/gemfiles/rails_6.1_vc_3.0.gemfile
+++ /dev/null
@@ -1,21 +0,0 @@
-# This file was generated by Appraisal
-
-source "https://rubygems.org"
-
-gem "appraisal", require: false
-gem "capybara", require: false
-gem "combustion", "~> 1.3.7"
-gem "generator_spec"
-gem "rails", "~> 6.1.0"
-gem "rake", "~> 13.0"
-gem "rspec", "~> 3.0", require: false
-gem "rspec-html-matchers"
-gem "rspec-rails", require: false
-gem "rubocop", require: false
-gem "rubocop-performance", require: false
-gem "rubocop-rspec", require: false
-gem "simplecov", require: false, group: :test
-gem "sqlite3", "~> 1.4", group: :test
-gem "view_component", ">= 3.0.0", "< 4.0"
-
-gemspec path: "../"
diff --git a/gemfiles/rails_7.0_vc_2.0.gemfile b/gemfiles/rails_7.0_vc_2.0.gemfile
index dfcf0c8..b2a36fc 100644
--- a/gemfiles/rails_7.0_vc_2.0.gemfile
+++ b/gemfiles/rails_7.0_vc_2.0.gemfile
@@ -16,5 +16,6 @@ gem "rubocop-performance", require: false
gem "rubocop-rspec", require: false
gem "simplecov", require: false, group: :test
gem "sqlite3", "~> 1.4", group: :test
+gem "concurrent-ruby", "!= 3.1.5"
gemspec path: "../"
diff --git a/gemfiles/rails_7.0_vc_3.0.gemfile b/gemfiles/rails_7.0_vc_3.0.gemfile
index 6007867..4cf14f8 100644
--- a/gemfiles/rails_7.0_vc_3.0.gemfile
+++ b/gemfiles/rails_7.0_vc_3.0.gemfile
@@ -16,6 +16,7 @@ gem "rubocop-performance", require: false
gem "rubocop-rspec", require: false
gem "simplecov", require: false, group: :test
gem "sqlite3", "~> 1.4", group: :test
+gem "concurrent-ruby", "!= 3.1.5"
gem "view_component", ">= 3.0.0", "< 4.0"
gemspec path: "../"
diff --git a/gemfiles/rails_7.1_vc_2.0.gemfile b/gemfiles/rails_7.1_vc_2.0.gemfile
index 18e534a..2e44da0 100644
--- a/gemfiles/rails_7.1_vc_2.0.gemfile
+++ b/gemfiles/rails_7.1_vc_2.0.gemfile
@@ -16,5 +16,6 @@ gem "rubocop-performance", require: false
gem "rubocop-rspec", require: false
gem "simplecov", require: false, group: :test
gem "sqlite3", "~> 1.4", group: :test
+gem "concurrent-ruby", "!= 3.1.5"
gemspec path: "../"
diff --git a/gemfiles/rails_7.1_vc_3.0.gemfile b/gemfiles/rails_7.1_vc_3.0.gemfile
index 524e684..db41d58 100644
--- a/gemfiles/rails_7.1_vc_3.0.gemfile
+++ b/gemfiles/rails_7.1_vc_3.0.gemfile
@@ -16,6 +16,7 @@ gem "rubocop-performance", require: false
gem "rubocop-rspec", require: false
gem "simplecov", require: false, group: :test
gem "sqlite3", "~> 1.4", group: :test
+gem "concurrent-ruby", "!= 3.1.5"
gem "view_component", ">= 3.0.0", "< 4.0"
gemspec path: "../"
diff --git a/gemfiles/rails_7.2_vc_2.0.gemfile b/gemfiles/rails_7.2_vc_2.0.gemfile
index 1215485..a7f9efc 100644
--- a/gemfiles/rails_7.2_vc_2.0.gemfile
+++ b/gemfiles/rails_7.2_vc_2.0.gemfile
@@ -16,5 +16,6 @@ gem "rubocop-performance", require: false
gem "rubocop-rspec", require: false
gem "simplecov", require: false, group: :test
gem "sqlite3", "~> 1.4", group: :test
+gem "concurrent-ruby", "!= 3.1.5"
gemspec path: "../"
diff --git a/gemfiles/rails_7.2_vc_3.0.gemfile b/gemfiles/rails_7.2_vc_3.0.gemfile
index e6d6b3e..52eea68 100644
--- a/gemfiles/rails_7.2_vc_3.0.gemfile
+++ b/gemfiles/rails_7.2_vc_3.0.gemfile
@@ -16,6 +16,7 @@ gem "rubocop-performance", require: false
gem "rubocop-rspec", require: false
gem "simplecov", require: false, group: :test
gem "sqlite3", "~> 1.4", group: :test
+gem "concurrent-ruby", "!= 3.1.5"
gem "view_component", ">= 3.0.0", "< 4.0"
gemspec path: "../"
diff --git a/gemfiles/rails_8.0_vc_2.0.gemfile b/gemfiles/rails_8.0_vc_2.0.gemfile
index a20288f..4066cd4 100644
--- a/gemfiles/rails_8.0_vc_2.0.gemfile
+++ b/gemfiles/rails_8.0_vc_2.0.gemfile
@@ -16,5 +16,6 @@ gem "rubocop-performance", require: false
gem "rubocop-rspec", require: false
gem "simplecov", require: false, group: :test
gem "sqlite3", "~> 2.1", group: :test
+gem "concurrent-ruby", "!= 3.1.5"
gemspec path: "../"
diff --git a/gemfiles/rails_8.0_vc_3.0.gemfile b/gemfiles/rails_8.0_vc_3.0.gemfile
index 281c11e..7238761 100644
--- a/gemfiles/rails_8.0_vc_3.0.gemfile
+++ b/gemfiles/rails_8.0_vc_3.0.gemfile
@@ -16,6 +16,7 @@ gem "rubocop-performance", require: false
gem "rubocop-rspec", require: false
gem "simplecov", require: false, group: :test
gem "sqlite3", "~> 2.1", group: :test
+gem "concurrent-ruby", "!= 3.1.5"
gem "view_component", ">= 3.0.0", "< 4.0"
gemspec path: "../"
diff --git a/gemfiles/rails_head_vc_2.0.gemfile b/gemfiles/rails_head_vc_2.0.gemfile
index ed7e5ee..79db4e7 100644
--- a/gemfiles/rails_head_vc_2.0.gemfile
+++ b/gemfiles/rails_head_vc_2.0.gemfile
@@ -16,5 +16,6 @@ gem "rubocop-performance", require: false
gem "rubocop-rspec", require: false
gem "simplecov", require: false, group: :test
gem "sqlite3", "~> 2.1", group: :test
+gem "concurrent-ruby", "!= 3.1.5"
gemspec path: "../"
diff --git a/gemfiles/rails_head_vc_3.0.gemfile b/gemfiles/rails_head_vc_3.0.gemfile
index e1667f6..3719cc3 100644
--- a/gemfiles/rails_head_vc_3.0.gemfile
+++ b/gemfiles/rails_head_vc_3.0.gemfile
@@ -16,6 +16,7 @@ gem "rubocop-performance", require: false
gem "rubocop-rspec", require: false
gem "simplecov", require: false, group: :test
gem "sqlite3", "~> 2.1", group: :test
+gem "concurrent-ruby", "!= 3.1.5"
gem "view_component", ">= 3.0.0", "< 4.0"
gemspec path: "../"
diff --git a/lib/view_component/form/builder.rb b/lib/view_component/form/builder.rb
index 3521e73..36ab884 100644
--- a/lib/view_component/form/builder.rb
+++ b/lib/view_component/form/builder.rb
@@ -6,7 +6,6 @@ class Builder < ActionView::Helpers::FormBuilder
include ViewComponent::Form::Renderer
include ViewComponent::Form::ValidationContext
include ViewComponent::Form::Helpers::Rails
- include ViewComponent::Form::Helpers::Rails7Backports if ::Rails::VERSION::MAJOR < 7
include ViewComponent::Form::Helpers::Custom
end
end
diff --git a/lib/view_component/form/class_names_helper.rb b/lib/view_component/form/class_names_helper.rb
deleted file mode 100644
index 12302ed..0000000
--- a/lib/view_component/form/class_names_helper.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-# frozen_string_literal: true
-
-# Backport of https://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-class_names
-# :nocov:
-module ViewComponent
- module Form
- module ClassNamesHelper
- # rubocop:disable Metrics/CyclomaticComplexity
- # rubocop:disable Metrics/MethodLength
- def build_tag_values(*args)
- tag_values = []
-
- args.each do |tag_value|
- case tag_value
- when Hash
- tag_value.each do |key, val|
- tag_values << key.to_s if val && key.present?
- end
- when Array
- tag_values.concat build_tag_values(*tag_value)
- else
- tag_values << tag_value.to_s if tag_value.present?
- end
- end
-
- tag_values
- end
- # rubocop:enable Metrics/CyclomaticComplexity
- # rubocop:enable Metrics/MethodLength
-
- def class_names(*args)
- tokens = build_tag_values(*args).flat_map { |value| value.to_s.split(/\s+/) }.uniq
-
- safe_join(tokens, " ")
- end
- end
- end
-end
-# :nocov:
diff --git a/lib/view_component/form/helpers/rails_7_backports.rb b/lib/view_component/form/helpers/rails_7_backports.rb
deleted file mode 100644
index 6d8310f..0000000
--- a/lib/view_component/form/helpers/rails_7_backports.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-module ViewComponent
- module Form
- module Helpers
- module Rails7Backports
- def field_id(method_name, *suffixes, namespace: @options[:namespace], index: @index)
- object_name = object_name.model_name.singular if object_name.respond_to?(:model_name)
-
- sanitized_object_name = object_name.to_s.gsub(/\]\[|[^-a-zA-Z0-9:.]/, "_").delete_suffix("_")
-
- sanitized_method_name = method_name.to_s.delete_suffix("?")
-
- [
- namespace,
- sanitized_object_name.presence,
- (index unless sanitized_object_name.empty?),
- sanitized_method_name,
- *suffixes
- ].tap(&:compact!).join("_")
- end
- end
- end
- end
-end
diff --git a/lib/view_component/form/test_helpers.rb b/lib/view_component/form/test_helpers.rb
index f16eb92..3d871e3 100644
--- a/lib/view_component/form/test_helpers.rb
+++ b/lib/view_component/form/test_helpers.rb
@@ -15,18 +15,10 @@ def object_name
:user
end
- if Gem::Version.new(Rails::VERSION::STRING) >= Gem::Version.new("6.1")
- def template
- lookup_context = ActionView::LookupContext.new(ActionController::Base.view_paths)
+ def template
+ lookup_context = ActionView::LookupContext.new(ActionController::Base.view_paths)
- ActionView::Base.new(lookup_context, {}, ApplicationController.new)
- end
- else
- def template
- lookup_context = ActionView::LookupContext.new(ActionController::Base.view_paths)
-
- ActionView::Base.new(lookup_context, {})
- end
+ ActionView::Base.new(lookup_context, {}, ApplicationController.new)
end
end
end
diff --git a/spec/view_component/form/builder_spec.rb b/spec/view_component/form/builder_spec.rb
index a5a6e96..540c50b 100644
--- a/spec/view_component/form/builder_spec.rb
+++ b/spec/view_component/form/builder_spec.rb
@@ -142,9 +142,7 @@
it_behaves_like "the default form builder", :time_zone_select, :time_zone, nil, { include_blank: true }
it_behaves_like "the default form builder", :url_field, :homepage
it_behaves_like "the default form builder", :week_field, :birthday_week
- if Rails::VERSION::MAJOR >= 7
- it_behaves_like "the default form builder", :weekday_select, :weekday, { include_blank: true }
- end
+ it_behaves_like "the default form builder", :weekday_select, :weekday, { include_blank: true }
describe "#component_klass" do
context "with gem Builder" do
@@ -194,13 +192,7 @@
end
describe "#field_id" do
- if Rails::VERSION::MAJOR >= 7
- it_behaves_like "the default form builder", :field_id, :first_name, :hint
- else
- let(:builder) { described_class.new(object_name, object, template, options) }
-
- it { expect(builder.send(:field_id, :first_name, :hint)).to eq("first_name_hint") }
- end
+ it_behaves_like "the default form builder", :field_id, :first_name, :hint
end
describe "#validation_context" do
diff --git a/spec/view_component/form/file_field_component_spec.rb b/spec/view_component/form/file_field_component_spec.rb
index e7d8d50..68cbb30 100644
--- a/spec/view_component/form/file_field_component_spec.rb
+++ b/spec/view_component/form/file_field_component_spec.rb
@@ -26,15 +26,13 @@
end
end
- if Gem::Version.new(Rails::VERSION::STRING) >= Gem::Version.new("7.0")
- context "with multiple and include hidden" do
- let(:options) { { multiple: true, include_hidden: true } }
-
- it do
- expect(component).to eq_html <<~HTML
-
- HTML
- end
+ context "with multiple and include hidden" do
+ let(:options) { { multiple: true, include_hidden: true } }
+
+ it do
+ expect(component).to eq_html <<~HTML
+
+ HTML
end
end
diff --git a/spec/view_component/form/weekday_select_component_spec.rb b/spec/view_component/form/weekday_select_component_spec.rb
index b7ae95c..9928ed6 100644
--- a/spec/view_component/form/weekday_select_component_spec.rb
+++ b/spec/view_component/form/weekday_select_component_spec.rb
@@ -1,23 +1,21 @@
# frozen_string_literal: true
-if Rails::VERSION::MAJOR >= 7
- RSpec.describe ViewComponent::Form::WeekdaySelectComponent, type: :component do
- let(:object) { OpenStruct.new }
- let(:form) { form_with(object) }
- let(:options) { {} }
- let(:html_options) { {} }
+RSpec.describe ViewComponent::Form::WeekdaySelectComponent, type: :component do
+ let(:object) { OpenStruct.new }
+ let(:form) { form_with(object) }
+ let(:options) { {} }
+ let(:html_options) { {} }
- let(:component) { render_inline(described_class.new(form, object_name, :weekday, options, html_options)) }
- let(:component_html_attributes) { component.css("select").first.attributes }
+ let(:component) { render_inline(described_class.new(form, object_name, :weekday, options, html_options)) }
+ let(:component_html_attributes) { component.css("select").first.attributes }
- context "with simple args" do
- it "has a select for the weekdays" do
- expect(component.to_html).to have_tag("select",
- with: { id: "user_weekday", name: "user[weekday]" })
- end
+ context "with simple args" do
+ it "has a select for the weekdays" do
+ expect(component.to_html).to have_tag("select",
+ with: { id: "user_weekday", name: "user[weekday]" })
end
-
- include_examples "component with custom html classes", :html_options
- include_examples "component with custom data attributes", :html_options
end
+
+ include_examples "component with custom html classes", :html_options
+ include_examples "component with custom data attributes", :html_options
end