From 2b4e2bffb4566078156d7fd9bbaae67e51611634 Mon Sep 17 00:00:00 2001 From: Igor Gonchar Date: Tue, 24 Oct 2023 10:05:34 +0300 Subject: [PATCH] update ruby/rails/activeadmin matrix --- .github/workflows/ci.yml | 27 ++++++++++++++++----------- Gemfile | 9 +++++---- active_admin_datetimepicker.gemspec | 2 +- spec/filter_form_spec.rb | 8 ++++---- spec/spec_helper.rb | 2 +- spec/support/admin.rb | 2 +- spec/support/rails_template.rb | 4 ++-- 7 files changed, 30 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 809eb11..b3e14f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,25 +11,30 @@ jobs: strategy: matrix: ruby: - - 2.5 - - 2.6 + - 3.0 + - 3.1 + - 3.2 rails: - - '5.2.0' - - '6.0.0' + - '6.1.0' + - '7.0.0' + - '7.1.0' activeadmin: - - '2.0.0' - - '2.6.0' + - '2.14.0' + - '3.0.0' + - '3.1.0' exclude: - - rails: '5.2.0' - activeadmin: '2.6.0' - - rails: '6.0.0' - activeadmin: '2.0.0' + - rails: '7.0.0' + activeadmin: '2.14.0' + - rails: '7.1.0' + activeadmin: '2.14.0' + - rails: '7.1.0' + activeadmin: '3.0.0' env: RAILS: ${{ matrix.rails }} AA: ${{ matrix.activeadmin }} steps: - uses: actions/checkout@v2 - - uses: actions/setup-ruby@v1 + - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} - name: Run tests diff --git a/Gemfile b/Gemfile index 0607cf3..463ead6 100644 --- a/Gemfile +++ b/Gemfile @@ -4,15 +4,15 @@ source 'https://rubygems.org' gemspec group :test do - default_rails_version = '6.0.0' - default_activeadmin_version = '2.6.0' + default_rails_version = '7.0.0' + default_activeadmin_version = '3.0.0' gem 'rails', "~> #{ENV['RAILS'] || default_rails_version}" gem 'activeadmin', "~> #{ENV['AA'] || default_activeadmin_version}" - gem 'sprockets-rails', '3.0.4' + gem 'sprockets-rails' gem 'rspec-rails' - gem 'coveralls', require: false # Test coverage website. Go to https://coveralls.io + gem 'coveralls_reborn', require: false # Test coverage website. Go to https://coveralls.io gem 'sass-rails' gem 'sqlite3', '~> 1.4.0' gem 'launchy' @@ -20,4 +20,5 @@ group :test do gem 'capybara' gem 'webdrivers' gem 'byebug' + gem 'webrick', require: false end diff --git a/active_admin_datetimepicker.gemspec b/active_admin_datetimepicker.gemspec index bf8311c..c364d5a 100644 --- a/active_admin_datetimepicker.gemspec +++ b/active_admin_datetimepicker.gemspec @@ -19,5 +19,5 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_dependency "activeadmin", ">= 2.0", "< 3.a" + spec.add_dependency "activeadmin", ">= 2.14" end diff --git a/spec/filter_form_spec.rb b/spec/filter_form_spec.rb index 131605f..956e0c7 100644 --- a/spec/filter_form_spec.rb +++ b/spec/filter_form_spec.rb @@ -49,11 +49,11 @@ before do Author.create!(name: "Ren", last_name: "from-20-day-of-month", - created_at: (Time.now.change(day: 20) - 1.hour).to_s(:db)) + created_at: (Time.now.change(day: 20) - 1.hour).to_fs(:db)) Author.create!(name: "Rey", last_name: "from-the-future", - created_at: (Time.now.change(day: 20) + 2.hours).to_s(:db)) + created_at: (Time.now.change(day: 20) + 2.hours).to_fs(:db)) # chose 01 and 20 day of the current month @@ -94,8 +94,8 @@ end context 'filter by virtual attribute last_seen_at - without column&type properties (search by updated_at)' do - let!(:first_author) { Author.create!(name: 'Ren', last_name: 'current', updated_at: Time.now.to_s(:db)) } - let!(:second_author) { Author.create!(name: 'Rey', last_name: 'future', updated_at: 21.days.from_now.to_s(:db)) } + let!(:first_author) { Author.create!(name: 'Ren', last_name: 'current', updated_at: Time.now.to_fs(:db)) } + let!(:second_author) { Author.create!(name: 'Rey', last_name: 'future', updated_at: 21.days.from_now.to_fs(:db)) } before do # chose 01 and 20 day of the current month diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c523fb4..5418252 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -14,7 +14,7 @@ ENV['RAILS'] = Rails.version ENV['RAILS_ROOT'] = File.expand_path("../rails/rails-#{ENV['RAILS']}", __FILE__) # Create the test app if it doesn't exists -unless File.exists?(ENV['RAILS_ROOT']) +unless File.exist?(ENV['RAILS_ROOT']) system 'rake setup' end diff --git a/spec/support/admin.rb b/spec/support/admin.rb index 45da288..e856ab1 100644 --- a/spec/support/admin.rb +++ b/spec/support/admin.rb @@ -8,7 +8,7 @@ def add_author_resource(options = {}, &block) filter :last_seen_at, as: :date_time_range form do |f| - f.semantic_errors *f.object.errors.keys + f.semantic_errors(*f.object.errors.attribute_names) f.inputs 'General' do f.input :name diff --git a/spec/support/rails_template.rb b/spec/support/rails_template.rb index 2c72a49..f88e6f0 100644 --- a/spec/support/rails_template.rb +++ b/spec/support/rails_template.rb @@ -3,8 +3,8 @@ generate :model, 'author name:string{10}:uniq last_name:string birthday:date' generate :model, 'post title:string:uniq body:text author:references' -#Add validation -inject_into_file "app/models/author.rb", " validates_presence_of :name\n validates_uniqueness_of :last_name\n\n attr_accessor :last_seen_at\n ransacker :last_seen_at do\n Arel.sql('updated_at')\n end\n", after: "ApplicationRecord\n" +# Add validation +inject_into_file "app/models/author.rb", " validates_presence_of :name\n validates_uniqueness_of :last_name\n\n attr_accessor :last_seen_at\n ransacker :last_seen_at do\n Arel.sql('updated_at')\n end\n def self.ransackable_attributes(auth_object = nil)\n attribute_names\n end\n def self.ransackable_associations(auth_object = nil)\n []\n end\n", after: "ApplicationRecord\n" inject_into_file "app/models/post.rb", " validates_presence_of :author\n", after: ":author\n" # Configure default_url_options in test environment