Skip to content

Commit

Permalink
Test against Rails 7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mshibuya committed Nov 27, 2023
1 parent 68ad436 commit 7b61544
Show file tree
Hide file tree
Showing 10 changed files with 106 additions and 15 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- "3.0"
- "3.1"
- "3.2"
gemfile: [gemfiles/rails_7.0.gemfile]
gemfile: [gemfiles/rails_7.1.gemfile]
orm: [active_record]
adapter: [sqlite3]
asset: [webpack]
Expand All @@ -32,22 +32,27 @@ jobs:
orm: active_record
adapter: sqlite3
asset: webpacker
- ruby: "3.0"
- ruby: "3.2"
gemfile: gemfiles/rails_7.0.gemfile
orm: active_record
adapter: sqlite3
asset: sprockets
- ruby: "3.2"
gemfile: gemfiles/rails_7.1.gemfile
orm: active_record
adapter: mysql2
asset: importmap
- ruby: "3.0"
gemfile: gemfiles/rails_7.0.gemfile
- ruby: "3.2"
gemfile: gemfiles/rails_7.1.gemfile
orm: active_record
adapter: postgresql
asset: sprockets
- ruby: "3.0"
gemfile: gemfiles/rails_7.0.gemfile
- ruby: "3.2"
gemfile: gemfiles/rails_7.1.gemfile
orm: active_record
adapter: sqlite3
asset: vite
- ruby: "3.0"
- ruby: "3.2"
gemfile: gemfiles/composite_primary_keys.gemfile
orm: active_record
adapter: sqlite3
Expand Down Expand Up @@ -172,7 +177,7 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.0"
ruby-version: "3.2"
- name: Cache gems
uses: actions/cache@v3
with:
Expand Down
19 changes: 19 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,25 @@ appraise 'rails-7.0' do
end
end

appraise 'rails-7.1' do
gem 'rails', '~> 7.1.0'
gem 'importmap-rails', require: false
gem 'sassc-rails', '~> 2.1'
gem 'devise', '~> 4.8'

group :test do
gem 'cancancan', '~> 3.2'
gem 'kt-paperclip'
gem 'rspec-rails', '>= 4.0.0.beta2'
gem 'shrine', '~> 3.0'
end

group :active_record do
gem 'pg', '>= 1.0.0', platforms: :ruby
gem 'paper_trail', '>= 12.0'
end
end

appraise 'composite_primary_keys' do
gem 'rails', '~> 7.0.0'
gem 'sassc-rails', '~> 2.1'
Expand Down
55 changes: 55 additions & 0 deletions gemfiles/rails_7.1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "appraisal", ">= 2.0"
gem "devise", "~> 4.8"
gem "net-smtp", require: false
gem "rails", "~> 7.1.0"
gem "vite_rails", require: false
gem "webpacker", require: false
gem "webrick"
gem "importmap-rails", require: false
gem "sassc-rails", "~> 2.1"

group :active_record do
gem "paper_trail", ">= 12.0"
gem "pg", ">= 1.0.0", platforms: :ruby

platforms :ruby, :mswin, :mingw, :x64_mingw do
gem "mysql2", ">= 0.3.14"
gem "sqlite3", ">= 1.3"
end
end

group :development, :test do
gem "pry", ">= 0.9"
end

group :test do
gem "cancancan", "~> 3.2"
gem "carrierwave", [">= 2.0.0.rc", "< 3"]
gem "cuprite"
gem "database_cleaner-active_record", ">= 2.0", require: false
gem "database_cleaner-mongoid", ">= 2.0", require: false
gem "dragonfly", "~> 1.0"
gem "factory_bot", ">= 4.2"
gem "generator_spec", ">= 0.8"
gem "launchy", ">= 2.2"
gem "mini_magick", ">= 3.4"
gem "pundit"
gem "rack-cache", require: "rack/cache"
gem "rspec-expectations", "!= 3.8.3"
gem "rspec-rails", ">= 4.0.0.beta2"
gem "rspec-retry"
gem "rubocop", ["~> 1.20", "!= 1.22.2"], require: false
gem "rubocop-performance", require: false
gem "simplecov", ">= 0.9", require: false
gem "simplecov-lcov", require: false
gem "timecop", ">= 0.5"
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem "kt-paperclip"
gem "shrine", "~> 3.0"
end

gemspec path: "../"
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def resource_url(thumb = false)
end

register_instance_option :keep_method do
method_name if ::ActiveStorage.replace_on_assign_to_many
method_name if ::ActiveStorage.gem_version >= Gem::Version.new('7.1') || ::ActiveStorage.replace_on_assign_to_many
end

register_instance_option :delete_method do
Expand Down
6 changes: 5 additions & 1 deletion spec/dummy_app/app/active_record/field_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ class FieldTest < ActiveRecord::Base

mount_uploader :carrierwave_asset, CarrierwaveUploader
mount_uploaders :carrierwave_assets, CarrierwaveUploader
serialize :carrierwave_assets, JSON
if ActiveRecord.gem_version < Gem::Version.new('6.1')
serialize :carrierwave_assets, JSON
else
serialize :carrierwave_assets, coder: JSON
end

if defined?(ActiveStorage)
has_one_attached :active_storage_asset
Expand Down
6 changes: 5 additions & 1 deletion spec/dummy_app/app/active_record/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ class User < ActiveRecord::Base
# :token_authenticatable, :confirmable, :lockable and :timeoutable
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable

serialize :roles, Array
if ActiveRecord.gem_version < Gem::Version.new('6.1')
serialize :roles, Array
else
serialize :roles, coder: YAML, type: Array
end

# Add Paperclip support for avatars
has_attached_file :avatar, styles: {medium: '300x300>', thumb: '100x100>'}
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy_app/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Application < Rails::Application
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
config.load_defaults Rails.version[0, 3]
config.eager_load_paths.reject! { |p| p =~ %r{/app/([^/]+)} && !%W[controllers jobs locales mailers #{CI_ORM}].include?(Regexp.last_match[1]) }
config.eager_load_paths = (config.try(:all_eager_load_paths) || config.eager_load_paths).reject { |p| p =~ %r{/app/([^/]+)} && !%W[controllers jobs locales mailers #{CI_ORM}].include?(Regexp.last_match[1]) }
config.eager_load_paths += %W[#{config.root}/app/eager_loaded]
config.autoload_paths += %W[#{config.root}/lib]
config.i18n.load_path += Dir[Rails.root.join('app', 'locales', '*.{rb,yml}').to_s]
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy_app/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
config.action_controller.perform_caching = false

# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
config.action_dispatch.show_exceptions = :none

# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/fields/active_storage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
before do
# To suppress 'SQLite3::BusyException: database is locked' exception
@original = page.driver.browser.url_blacklist # rubocop:disable Naming/InclusiveLanguage
page.driver.browser.url_blacklist = ['/rails/active_storage/representations'] # rubocop:disable Naming/InclusiveLanguage
page.driver.browser.url_blacklist = [%r{/rails/active_storage/representations}] # rubocop:disable Naming/InclusiveLanguage
end
after { page.driver.browser.url_blacklist = @original } # rubocop:disable Naming/InclusiveLanguage

Expand Down
6 changes: 5 additions & 1 deletion spec/rails_admin/config/fields/types/enum_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@ def color_list
before do
class TeamWithSerializedEnum < Team
self.table_name = 'teams'
serialize :color
if ActiveRecord.gem_version < Gem::Version.new('6.1')
serialize :color
else
serialize :color, coder: JSON
end
def color_enum
%w[blue green red]
end
Expand Down

0 comments on commit 7b61544

Please sign in to comment.