Skip to content

Commit

Permalink
update ruby/rails/activeadmin matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
gigorok committed Oct 25, 2023
1 parent 84ebc63 commit 2b4e2bf
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 24 deletions.
27 changes: 16 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@ 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'
gem 'database_cleaner'
gem 'capybara'
gem 'webdrivers'
gem 'byebug'
gem 'webrick', require: false
end
2 changes: 1 addition & 1 deletion active_admin_datetimepicker.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions spec/filter_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion spec/support/admin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/support/rails_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2b4e2bf

Please sign in to comment.