diff --git a/.rspec b/.rspec index 6378586..a35c44f 100644 --- a/.rspec +++ b/.rspec @@ -1,2 +1 @@ --require rails_helper ---format documentation diff --git a/Appraisals b/Appraisals index e89f433..cd71bf3 100644 --- a/Appraisals +++ b/Appraisals @@ -13,11 +13,9 @@ end appraise 'rails70-activeadmin' do gem 'activeadmin' gem 'rails', '~> 7.0.0' - gem 'sprockets-rails' end appraise 'rails71-activeadmin' do gem 'activeadmin' gem 'rails', '~> 7.1.0' - gem 'sprockets-rails' end diff --git a/Gemfile b/Gemfile index 8450e3b..63f9fd8 100644 --- a/Gemfile +++ b/Gemfile @@ -7,6 +7,7 @@ gemspec group :development, :test do gem 'puma' gem 'sassc' + gem 'sprockets-rails' gem 'sqlite3' # Testing diff --git a/gemfiles/rails61_activeadmin.gemfile b/gemfiles/rails61_activeadmin.gemfile index 184df44..566be21 100644 --- a/gemfiles/rails61_activeadmin.gemfile +++ b/gemfiles/rails61_activeadmin.gemfile @@ -8,6 +8,7 @@ gem "rails", "~> 6.1.0" group :development, :test do gem "puma" gem "sassc" + gem "sprockets-rails" gem "sqlite3" gem "capybara" gem "cuprite" diff --git a/gemfiles/rails61_activeadmin.gemfile.lock b/gemfiles/rails61_activeadmin.gemfile.lock index 0e16bf0..b9aaf93 100644 --- a/gemfiles/rails61_activeadmin.gemfile.lock +++ b/gemfiles/rails61_activeadmin.gemfile.lock @@ -337,6 +337,7 @@ DEPENDENCIES rubocop-rails rubocop-rspec sassc + sprockets-rails sqlite3 BUNDLED WITH diff --git a/gemfiles/rails61_activeadmin29.gemfile b/gemfiles/rails61_activeadmin29.gemfile index ef2dbe8..c3674ea 100644 --- a/gemfiles/rails61_activeadmin29.gemfile +++ b/gemfiles/rails61_activeadmin29.gemfile @@ -8,6 +8,7 @@ gem "rails", "~> 6.1.0" group :development, :test do gem "puma" gem "sassc" + gem "sprockets-rails" gem "sqlite3" gem "capybara" gem "cuprite" diff --git a/gemfiles/rails61_activeadmin29.gemfile.lock b/gemfiles/rails61_activeadmin29.gemfile.lock index ca17d1f..c275519 100644 --- a/gemfiles/rails61_activeadmin29.gemfile.lock +++ b/gemfiles/rails61_activeadmin29.gemfile.lock @@ -337,6 +337,7 @@ DEPENDENCIES rubocop-rails rubocop-rspec sassc + sprockets-rails sqlite3 BUNDLED WITH diff --git a/gemfiles/rails70_activeadmin.gemfile b/gemfiles/rails70_activeadmin.gemfile index 0e673ab..8804b01 100644 --- a/gemfiles/rails70_activeadmin.gemfile +++ b/gemfiles/rails70_activeadmin.gemfile @@ -4,11 +4,11 @@ source "https://rubygems.org" gem "activeadmin" gem "rails", "~> 7.0.0" -gem "sprockets-rails" group :development, :test do gem "puma" gem "sassc" + gem "sprockets-rails" gem "sqlite3" gem "capybara" gem "cuprite" diff --git a/gemfiles/rails71_activeadmin.gemfile b/gemfiles/rails71_activeadmin.gemfile index 951c36c..c88fd13 100644 --- a/gemfiles/rails71_activeadmin.gemfile +++ b/gemfiles/rails71_activeadmin.gemfile @@ -4,11 +4,11 @@ source "https://rubygems.org" gem "activeadmin" gem "rails", "~> 7.1.0" -gem "sprockets-rails" group :development, :test do gem "puma" gem "sassc" + gem "sprockets-rails" gem "sqlite3" gem "capybara" gem "cuprite" diff --git a/spec/dummy/.ruby-version b/spec/dummy/.ruby-version deleted file mode 100644 index bff6ce5..0000000 --- a/spec/dummy/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -ruby-2.7.1 diff --git a/spec/dummy/.tool-versions b/spec/dummy/.tool-versions deleted file mode 100644 index 1c44dd0..0000000 --- a/spec/dummy/.tool-versions +++ /dev/null @@ -1 +0,0 @@ -ruby 2.6.6 diff --git a/spec/dummy/app/admin/profiles.rb b/spec/dummy/app/admin/profiles.rb new file mode 100644 index 0000000..37ed262 --- /dev/null +++ b/spec/dummy/app/admin/profiles.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +ActiveAdmin.register Profile do + permit_params :author_id, :description +end diff --git a/spec/dummy/app/models/author.rb b/spec/dummy/app/models/author.rb index b05a0d2..0c328c2 100644 --- a/spec/dummy/app/models/author.rb +++ b/spec/dummy/app/models/author.rb @@ -24,7 +24,9 @@ class Author < ApplicationRecord "#{name} (#{age})" end - def self.ransackable_attributes(auth_object = nil) - %w[age created_at email id name updated_at] + class << self + def ransackable_attributes(_auth_object = nil) + %w[age created_at email id name updated_at] + end end end diff --git a/spec/dummy/app/models/post.rb b/spec/dummy/app/models/post.rb index 7003055..3eb4c23 100644 --- a/spec/dummy/app/models/post.rb +++ b/spec/dummy/app/models/post.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class Post < ApplicationRecord - enum state: %i[available unavailable arriving] + # enum state: %i[available unavailable arriving] belongs_to :author, inverse_of: :posts, autosave: true @@ -27,11 +27,13 @@ class Post < ApplicationRecord title.upcase end - def self.ransackable_attributes(auth_object = nil) - %w[author_id category created_at description dt id position published summary title updated_at] - end + class << self + def ransackable_attributes(auth_object = nil) + %w[author_id category created_at description dt id position published summary title updated_at] + end - def self.ransackable_associations(auth_object = nil) - %w[author author_profile images_attachments images_blobs post_tags tags] + def ransackable_associations(auth_object = nil) + %w[author author_profile images_attachments images_blobs post_tags tags] + end end end diff --git a/spec/dummy/app/models/post_tag.rb b/spec/dummy/app/models/post_tag.rb index ce79a9f..fd32b91 100644 --- a/spec/dummy/app/models/post_tag.rb +++ b/spec/dummy/app/models/post_tag.rb @@ -7,7 +7,9 @@ class PostTag < ApplicationRecord validates :post, presence: true validates :tag, presence: true - def self.ransackable_attributes(auth_object = nil) - %w[created_at id post_id tag_id updated_at] + class << self + def ransackable_attributes(auth_object = nil) + %w[created_at id post_id tag_id updated_at] + end end end diff --git a/spec/dummy/app/models/profile.rb b/spec/dummy/app/models/profile.rb index beac97a..d6f373d 100644 --- a/spec/dummy/app/models/profile.rb +++ b/spec/dummy/app/models/profile.rb @@ -3,11 +3,19 @@ class Profile < ApplicationRecord belongs_to :author, inverse_of: :profile, touch: true - def to_s - description - end + # has_rich_text :description - def self.ransackable_attributes(auth_object = nil) - %w[author_id created_at description id updated_at] + # def to_s + # description + # end + + class << self + def ransackable_associations(auth_object = nil) + %w[author] + end + + def ransackable_attributes(_auth_object = nil) + %w[author_id created_at description id updated_at] + end end end diff --git a/spec/dummy/app/models/tag.rb b/spec/dummy/app/models/tag.rb index 50a59bc..deb2372 100644 --- a/spec/dummy/app/models/tag.rb +++ b/spec/dummy/app/models/tag.rb @@ -3,4 +3,14 @@ class Tag < ApplicationRecord has_many :post_tags, inverse_of: :tag, dependent: :destroy has_many :posts, through: :post_tags + + class << self + def ransackable_associations(auth_object = nil) + %w[post_tags posts] + end + + def ransackable_attributes(auth_object = nil) + %w[created_at id id_value name updated_at] + end + end end diff --git a/spec/dummy/config/application.rb b/spec/dummy/config/application.rb index 2f575f3..7107cdb 100644 --- a/spec/dummy/config/application.rb +++ b/spec/dummy/config/application.rb @@ -17,6 +17,10 @@ module Dummy ### - config.active_record.legacy_connection_handling = false if Rails::VERSION::MAJOR > 6 + config.active_record.legacy_connection_handling = false if Gem::Version.new(Rails.version) < Gem::Version.new('7.1') + + config.before_configuration do + ActiveSupport::Cache.format_version = 7.0 if Gem::Version.new(Rails.version) > Gem::Version.new('7.0') + end end end diff --git a/spec/dummy/config/environments/development.rb b/spec/dummy/config/environments/development.rb index 7a352dd..442b7fb 100644 --- a/spec/dummy/config/environments/development.rb +++ b/spec/dummy/config/environments/development.rb @@ -29,7 +29,7 @@ Rails.application.configure do end # Store uploaded files on the local file system (see config/storage.yml for options). - config.active_storage.service = :local + # config.active_storage.service = :local # # Don't care if the mailer can't send. # config.action_mailer.raise_delivery_errors = false diff --git a/spec/dummy/config/environments/test.rb b/spec/dummy/config/environments/test.rb index 270398b..8f83af4 100644 --- a/spec/dummy/config/environments/test.rb +++ b/spec/dummy/config/environments/test.rb @@ -26,7 +26,7 @@ Rails.application.configure do config.cache_store = :null_store # 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 diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 584edee..c1fbecb 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -15,7 +15,7 @@ require 'rspec/retry' Dir[File.expand_path('support/**/*.rb', __dir__)].each { |f| require f } # Force deprecations to raise an exception. -ActiveSupport::Deprecation.behavior = :raise +# ActiveSupport::Deprecation.behavior = :raise # Checks for pending migrations and applies them before tests are run. # If you are not using ActiveRecord, you can remove these lines. @@ -27,7 +27,6 @@ rescue ActiveRecord::PendingMigrationError => e end RSpec.configure do |config| - config.fixture_path = Rails.root.join('spec/fixtures').to_s config.infer_spec_type_from_file_location! config.filter_rails_from_backtrace!