Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Rails 7 #2324

Merged
merged 4 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 64 additions & 58 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,65 +13,71 @@ PATH
GEM
remote: https://rubygems.org/
specs:
actioncable (6.1.7.3)
actionpack (= 6.1.7.3)
activesupport (= 6.1.7.3)
actioncable (7.0.4.3)
actionpack (= 7.0.4.3)
activesupport (= 7.0.4.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.7.3)
actionpack (= 6.1.7.3)
activejob (= 6.1.7.3)
activerecord (= 6.1.7.3)
activestorage (= 6.1.7.3)
activesupport (= 6.1.7.3)
actionmailbox (7.0.4.3)
actionpack (= 7.0.4.3)
activejob (= 7.0.4.3)
activerecord (= 7.0.4.3)
activestorage (= 7.0.4.3)
activesupport (= 7.0.4.3)
mail (>= 2.7.1)
actionmailer (6.1.7.3)
actionpack (= 6.1.7.3)
actionview (= 6.1.7.3)
activejob (= 6.1.7.3)
activesupport (= 6.1.7.3)
net-imap
net-pop
net-smtp
actionmailer (7.0.4.3)
actionpack (= 7.0.4.3)
actionview (= 7.0.4.3)
activejob (= 7.0.4.3)
activesupport (= 7.0.4.3)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (6.1.7.3)
actionview (= 6.1.7.3)
activesupport (= 6.1.7.3)
rack (~> 2.0, >= 2.0.9)
actionpack (7.0.4.3)
actionview (= 7.0.4.3)
activesupport (= 7.0.4.3)
rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.7.3)
actionpack (= 6.1.7.3)
activerecord (= 6.1.7.3)
activestorage (= 6.1.7.3)
activesupport (= 6.1.7.3)
actiontext (7.0.4.3)
actionpack (= 7.0.4.3)
activerecord (= 7.0.4.3)
activestorage (= 7.0.4.3)
activesupport (= 7.0.4.3)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (6.1.7.3)
activesupport (= 6.1.7.3)
actionview (7.0.4.3)
activesupport (= 7.0.4.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.7.3)
activesupport (= 6.1.7.3)
activejob (7.0.4.3)
activesupport (= 7.0.4.3)
globalid (>= 0.3.6)
activemodel (6.1.7.3)
activesupport (= 6.1.7.3)
activerecord (6.1.7.3)
activemodel (= 6.1.7.3)
activesupport (= 6.1.7.3)
activestorage (6.1.7.3)
actionpack (= 6.1.7.3)
activejob (= 6.1.7.3)
activerecord (= 6.1.7.3)
activesupport (= 6.1.7.3)
activemodel (7.0.4.3)
activesupport (= 7.0.4.3)
activerecord (7.0.4.3)
activemodel (= 7.0.4.3)
activesupport (= 7.0.4.3)
activestorage (7.0.4.3)
actionpack (= 7.0.4.3)
activejob (= 7.0.4.3)
activerecord (= 7.0.4.3)
activesupport (= 7.0.4.3)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (6.1.7.3)
activesupport (7.0.4.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.2)
public_suffix (>= 2.0.2, < 6.0)
administrate-field-image (1.2.0)
Expand Down Expand Up @@ -179,7 +185,7 @@ GEM
kgio (2.11.4)
launchy (2.5.2)
addressable (~> 2.8)
loofah (2.19.1)
loofah (2.20.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.8.1)
Expand All @@ -202,7 +208,7 @@ GEM
timeout
net-smtp (0.3.3)
net-protocol
nio4r (2.5.8)
nio4r (2.5.9)
nokogiri (1.14.3)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
Expand All @@ -220,21 +226,20 @@ GEM
rack-test (2.1.0)
rack (>= 1.3)
rack-timeout (0.6.3)
rails (6.1.7.3)
actioncable (= 6.1.7.3)
actionmailbox (= 6.1.7.3)
actionmailer (= 6.1.7.3)
actionpack (= 6.1.7.3)
actiontext (= 6.1.7.3)
actionview (= 6.1.7.3)
activejob (= 6.1.7.3)
activemodel (= 6.1.7.3)
activerecord (= 6.1.7.3)
activestorage (= 6.1.7.3)
activesupport (= 6.1.7.3)
rails (7.0.4.3)
actioncable (= 7.0.4.3)
actionmailbox (= 7.0.4.3)
actionmailer (= 7.0.4.3)
actionpack (= 7.0.4.3)
actiontext (= 7.0.4.3)
actionview (= 7.0.4.3)
activejob (= 7.0.4.3)
activemodel (= 7.0.4.3)
activerecord (= 7.0.4.3)
activestorage (= 7.0.4.3)
activesupport (= 7.0.4.3)
bundler (>= 1.15.0)
railties (= 6.1.7.3)
sprockets-rails (>= 2.0.0)
railties (= 7.0.4.3)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
Expand All @@ -243,12 +248,13 @@ GEM
rails-i18n (7.0.6)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
railties (6.1.7.3)
actionpack (= 6.1.7.3)
activesupport (= 6.1.7.3)
railties (7.0.4.3)
actionpack (= 7.0.4.3)
activesupport (= 7.0.4.3)
method_source
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
raindrops (0.20.1)
rake (13.0.6)
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails70.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ gem "pundit"
gem "redcarpet"
gem "sentry-raven"
gem "unicorn"
gem "rails", "~> 6.1"
gem "rails", "~> 7.0"

group :development, :test do
gem "appraisal"
Expand Down
6 changes: 5 additions & 1 deletion lib/generators/administrate/routes/routes_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
require "rails/generators/base"
require "administrate/generator_helpers"
require "administrate/namespace"
require "generators/administrate/test_record"

module Administrate
module Generators
Expand Down Expand Up @@ -60,7 +61,10 @@ def valid_dashboard_models
end

def database_models
ActiveRecord::Base.descendants.reject(&:abstract_class?)
ActiveRecord::Base.descendants.
reject(&:abstract_class?).
reject { |k| k < Administrate::Generators::TestRecord }.
sort_by(&:to_s)
end

def invalid_dashboard_models
Expand Down
21 changes: 21 additions & 0 deletions lib/generators/administrate/test_record.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module Administrate
module Generators
# This class serves only to work around a strange behaviour in Rails 7
# with Ruby 3.
#
# After running the spec for DashboardGenerator, the fake models that
# it generates (eg: Foo, Shipment) linger around despite being removed
# explicitly. This causes RouteGenerator to take them into
# account and generate routes for them, which its spec doesn't expect,
# causing a spec failure.
#
# To avoid this, the spec for DashboardGenerator defines its fake models
# as children of TestRecord. Then RoutesGenerator explicitly filters
# child classes of TestRecord when figuring out what models exist.
#
# Discussion at https://github.com/thoughtbot/administrate/pull/2324
class TestRecord < ApplicationRecord
self.abstract_class = true
end
end
end
1 change: 1 addition & 0 deletions spec/administrate/views/fields/select/_edit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def build_template
Object.new.tap do |template|
template.extend ActionView::Helpers::FormHelper
template.extend ActionView::Helpers::FormOptionsHelper
template.extend ActionView::Helpers::FormTagHelper
end
end
end
3 changes: 2 additions & 1 deletion spec/administrate/views/fields/url/_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require "administrate/field/url"

describe "fields/url/_form", type: :view do
it "displays the resource name" do
it "provides the correct name for the field" do
product = build(:product, image_url: nil)
url = instance_double(
"Administrate::Field::Url",
Expand Down Expand Up @@ -31,6 +31,7 @@ def build_template
Object.new.tap do |template|
template.extend ActionView::Helpers::FormHelper
template.extend ActionView::Helpers::FormOptionsHelper
template.extend ActionView::Helpers::FormTagHelper
end
end
end
Loading