From 11e02dec70751521fed6f0c9a17a9d32ab31b5ad Mon Sep 17 00:00:00 2001 From: Bram Jetten Date: Wed, 31 Jul 2024 20:11:09 +0100 Subject: [PATCH 01/11] Add support for MySQL and SQLite --- app/controllers/spina/admin/page_select_options_controller.rb | 4 ++-- .../spina/admin/resource_select_options_controller.rb | 2 +- app/models/concerns/spina/attachable.rb | 4 ++-- app/models/spina/resource.rb | 2 +- db/migrate/13_add_json_attributes_to_spina_accounts.rb | 2 +- db/migrate/14_add_json_attributes_to_spina_pages.rb | 2 +- db/migrate/15_add_slug_to_spina_resources.rb | 2 +- db/migrate/7_create_spina_settings.rb | 2 +- docs/v2/advanced/1_create_custom_parts.md | 2 +- spina.gemspec | 2 +- test/dummy/.ruby-version | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/controllers/spina/admin/page_select_options_controller.rb b/app/controllers/spina/admin/page_select_options_controller.rb index f63e1d65f..b335f86b2 100644 --- a/app/controllers/spina/admin/page_select_options_controller.rb +++ b/app/controllers/spina/admin/page_select_options_controller.rb @@ -15,10 +15,10 @@ def search end @pages ||= Page.all - @pages = @pages.joins(:translations).where("spina_page_translations.title ILIKE :query OR materialized_path ILIKE :query", query: "%#{params[:search]}%").order(created_at: :desc).distinct.page(params[:page]).per(20) + @pages = @pages.joins(:translations).where("LOWER(spina_page_translations.title) LIKE LOWER(:query) OR LOWER(materialized_path) LIKE LOWER(:query)", query: "%#{params[:search]}%").order(created_at: :desc).distinct.page(params[:page]).per(20) render :index end end end -end \ No newline at end of file +end diff --git a/app/controllers/spina/admin/resource_select_options_controller.rb b/app/controllers/spina/admin/resource_select_options_controller.rb index 708108599..fd35ee0f9 100644 --- a/app/controllers/spina/admin/resource_select_options_controller.rb +++ b/app/controllers/spina/admin/resource_select_options_controller.rb @@ -11,7 +11,7 @@ def index def search @resources ||= Resource.all - @resources = @resources.where("name ILIKE :query OR label ILIKE :query", query: "%#{params[:search]}%").order(created_at: :desc).distinct.page(params[:page]).per(20) + @resources = @resources.where("LOWER(name) LIKE LOWER(:query) OR LOWER(label) LIKE LOWER(:query)", query: "%#{params[:search]}%").order(created_at: :desc).distinct.page(params[:page]).per(20) render :index end diff --git a/app/models/concerns/spina/attachable.rb b/app/models/concerns/spina/attachable.rb index c7adb916d..d1b367b59 100644 --- a/app/models/concerns/spina/attachable.rb +++ b/app/models/concerns/spina/attachable.rb @@ -7,7 +7,7 @@ module Attachable scope :with_filename, ->(query) do joins(:file_blob).where( - "active_storage_blobs.filename ILIKE ?", + "LOWER(active_storage_blobs.filename) LIKE LOWER(?)", "%" + Image.sanitize_sql_like(query) + "%" ) end @@ -18,4 +18,4 @@ def name end end -end \ No newline at end of file +end diff --git a/app/models/spina/resource.rb b/app/models/spina/resource.rb index 35325ef1c..009b847ee 100644 --- a/app/models/spina/resource.rb +++ b/app/models/spina/resource.rb @@ -6,7 +6,7 @@ class Resource < ApplicationRecord after_commit :update_resource_pages, on: [:update] - translates :slug, backend: :jsonb + translates :slug, backend: :json def pages case order_by diff --git a/db/migrate/13_add_json_attributes_to_spina_accounts.rb b/db/migrate/13_add_json_attributes_to_spina_accounts.rb index f1f3c3087..515b30b89 100644 --- a/db/migrate/13_add_json_attributes_to_spina_accounts.rb +++ b/db/migrate/13_add_json_attributes_to_spina_accounts.rb @@ -1,5 +1,5 @@ class AddJsonAttributesToSpinaAccounts < ActiveRecord::Migration[5.2] def change - add_column :spina_accounts, :json_attributes, :jsonb + add_column :spina_accounts, :json_attributes, :json end end diff --git a/db/migrate/14_add_json_attributes_to_spina_pages.rb b/db/migrate/14_add_json_attributes_to_spina_pages.rb index c7b82935d..41ca4a132 100644 --- a/db/migrate/14_add_json_attributes_to_spina_pages.rb +++ b/db/migrate/14_add_json_attributes_to_spina_pages.rb @@ -1,5 +1,5 @@ class AddJsonAttributesToSpinaPages < ActiveRecord::Migration[5.2] def change - add_column :spina_pages, :json_attributes, :jsonb + add_column :spina_pages, :json_attributes, :json end end diff --git a/db/migrate/15_add_slug_to_spina_resources.rb b/db/migrate/15_add_slug_to_spina_resources.rb index 910e8bcc9..3341f1a64 100644 --- a/db/migrate/15_add_slug_to_spina_resources.rb +++ b/db/migrate/15_add_slug_to_spina_resources.rb @@ -1,5 +1,5 @@ class AddSlugToSpinaResources < ActiveRecord::Migration[5.2] def change - add_column :spina_resources, :slug, :jsonb + add_column :spina_resources, :slug, :json end end diff --git a/db/migrate/7_create_spina_settings.rb b/db/migrate/7_create_spina_settings.rb index f4ee57c9f..e68a490ad 100644 --- a/db/migrate/7_create_spina_settings.rb +++ b/db/migrate/7_create_spina_settings.rb @@ -2,7 +2,7 @@ class CreateSpinaSettings < ActiveRecord::Migration[5.0] def change create_table :spina_settings do |t| t.string :plugin - t.jsonb :preferences, default: {} + t.json :preferences, default: {} t.timestamps end diff --git a/docs/v2/advanced/1_create_custom_parts.md b/docs/v2/advanced/1_create_custom_parts.md index 5f556912b..e98a58ea0 100644 --- a/docs/v2/advanced/1_create_custom_parts.md +++ b/docs/v2/advanced/1_create_custom_parts.md @@ -1,6 +1,6 @@ # Custom parts -All page content is stored in a single JSONB-column in the database. Spina uses the `attr_json` gem to work with these nested json objects. All default parts are `AttrJson::Model` objects. Follow the steps below to create your own custom part. +All page content is stored in a single JSON-column in the database. Spina uses the `attr_json` gem to work with these nested json objects. All default parts are `AttrJson::Model` objects. Follow the steps below to create your own custom part. ## Step 1. Create a part Let's imagine our app contains a movie database. We'd like to add a part to select one of the movies in our collection. First we need to create the object that can be stored as page content. diff --git a/spina.gemspec b/spina.gemspec index d9b1c43e8..c35c800ec 100644 --- a/spina.gemspec +++ b/spina.gemspec @@ -35,7 +35,7 @@ Gem::Specification.new do |gem| gem.add_dependency "rails", ">= 6.0" gem.add_dependency "sprockets-rails" - gem.add_dependency "pg" + # gem.add_dependency "pg" gem.add_dependency "bcrypt" gem.add_dependency "image_processing" gem.add_dependency "ancestry" diff --git a/test/dummy/.ruby-version b/test/dummy/.ruby-version index be94e6f53..bea438e9a 100644 --- a/test/dummy/.ruby-version +++ b/test/dummy/.ruby-version @@ -1 +1 @@ -3.2.2 +3.3.1 From a63c25bfe4faf449c830399c2a1ee2862a650fba Mon Sep 17 00:00:00 2001 From: Bram Jetten Date: Tue, 8 Oct 2024 21:02:01 +0200 Subject: [PATCH 02/11] Change references to jsonb to json --- app/models/spina/account.rb | 2 +- spina.gemspec | 7 ------- test/dummy/db/schema.rb | 8 ++++---- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/app/models/spina/account.rb b/app/models/spina/account.rb index 41953c719..a5c2879c9 100644 --- a/app/models/spina/account.rb +++ b/app/models/spina/account.rb @@ -18,7 +18,7 @@ def to_s # Spina previously stored account preferences with symbols as keys. # Because of CVE-2022-32224 we're changing that to strings instead. # This fallback ensures backwards compatibility, but in the long run this - # should be refactored to use a simple JSONB-column with Postgres. + # should be refactored to use a simple JSON-column with Postgres. def self.serialized_attr_accessor(*args) args.each do |method_name| define_method method_name do diff --git a/spina.gemspec b/spina.gemspec index c35c800ec..06e565426 100644 --- a/spina.gemspec +++ b/spina.gemspec @@ -14,12 +14,6 @@ Gem::Specification.new do |gem| gem.summary = "Spina" gem.description = "CMS" gem.license = "MIT" - gem.post_install_message = %q{ - Spina v2.16 includes a new migration, don't forget to run spina:install:migrations. - - For details on this specific release, refer to the CHANGELOG file. - https://github.com/SpinaCMS/Spina/blob/main/CHANGELOG.md#2160-august-23rd-2022 - } gem.required_ruby_version = ">= 2.7.0" @@ -35,7 +29,6 @@ Gem::Specification.new do |gem| gem.add_dependency "rails", ">= 6.0" gem.add_dependency "sprockets-rails" - # gem.add_dependency "pg" gem.add_dependency "bcrypt" gem.add_dependency "image_processing" gem.add_dependency "ancestry" diff --git a/test/dummy/db/schema.rb b/test/dummy/db/schema.rb index 7f0e20254..dc39984c3 100644 --- a/test/dummy/db/schema.rb +++ b/test/dummy/db/schema.rb @@ -53,7 +53,7 @@ t.datetime "created_at", precision: nil, null: false t.datetime "updated_at", precision: nil, null: false t.boolean "robots_allowed", default: false - t.jsonb "json_attributes" + t.json "json_attributes" end create_table "spina_attachment_collections", id: :serial, force: :cascade do |t| @@ -193,7 +193,7 @@ t.integer "position" t.boolean "active", default: true t.integer "resource_id" - t.jsonb "json_attributes" + t.json "json_attributes" t.integer "ancestry_depth", default: 0 t.integer "ancestry_children_count" t.index ["resource_id"], name: "index_spina_pages_on_resource_id" @@ -207,7 +207,7 @@ t.string "order_by" t.datetime "created_at", precision: nil, null: false t.datetime "updated_at", precision: nil, null: false - t.jsonb "slug" + t.json "slug" t.index ["parent_page_id"], name: "index_spina_resources_on_parent_page_id" end @@ -220,7 +220,7 @@ create_table "spina_settings", id: :serial, force: :cascade do |t| t.string "plugin" - t.jsonb "preferences", default: {} + t.json "preferences", default: {} t.datetime "created_at", precision: nil, null: false t.datetime "updated_at", precision: nil, null: false t.index ["plugin"], name: "index_spina_settings_on_plugin" From 474d3ee959f8f62b3bdb26e7a676f8d5e0b6740d Mon Sep 17 00:00:00 2001 From: Bram Jetten Date: Tue, 8 Oct 2024 21:20:42 +0200 Subject: [PATCH 03/11] Make the replace signed id job database-agnostic --- app/jobs/spina/replace_signed_id_job.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/jobs/spina/replace_signed_id_job.rb b/app/jobs/spina/replace_signed_id_job.rb index 74a6ba875..7cfb0819b 100644 --- a/app/jobs/spina/replace_signed_id_job.rb +++ b/app/jobs/spina/replace_signed_id_job.rb @@ -5,19 +5,19 @@ class ReplaceSignedIdJob < ApplicationJob def perform(old_signed_id, new_signed_id) return if old_signed_id.blank? || new_signed_id.blank? - pages = get_pages(old_signed_id) + pages = Spina::Page.all accounts = Spina::Account.all [pages, accounts].each do |records| - records.update_all("json_attributes = REGEXP_REPLACE(json_attributes::text, '#{old_signed_id}', '#{new_signed_id}', 'g')::jsonb") + records.find_each(batch_size: 100) do |record| + json = record.json_attributes.to_json + next unless json.include?(old_signed_id) + + new_json = json.gsub(old_signed_id, new_signed_id) + record.update_columns(json_attributes: JSON.parse(new_json)) + end end end - private - - def get_pages(signed_id) - return Spina::Page.none unless signed_id.present? - Spina::Page.where("json_attributes::text LIKE ?", "%#{signed_id}%") - end end end From 2529be5083eecdd07a3ac2b82fd70ddb62128b8f Mon Sep 17 00:00:00 2001 From: Bram Jetten Date: Tue, 8 Oct 2024 21:39:44 +0200 Subject: [PATCH 04/11] Update to ruby 3.3.5 --- Gemfile.lock | 2 -- test/dummy/.ruby-version | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 969ba9d2a..0e7382acb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,7 +13,6 @@ PATH jsonapi-serializer kaminari mobility (>= 1.1.3) - pg rack-rewrite (>= 1.5.0) rails (>= 6.0) sprockets-rails @@ -210,7 +209,6 @@ GEM nokogiri (1.16.0) mini_portile2 (~> 2.8.2) racc (~> 1.4) - pg (1.5.4) pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) diff --git a/test/dummy/.ruby-version b/test/dummy/.ruby-version index bea438e9a..fa7adc7ac 100644 --- a/test/dummy/.ruby-version +++ b/test/dummy/.ruby-version @@ -1 +1 @@ -3.3.1 +3.3.5 From 2cd81df06c36d1d12bfc2010b9275e132e4271f7 Mon Sep 17 00:00:00 2001 From: Bram Jetten Date: Tue, 8 Oct 2024 21:42:49 +0200 Subject: [PATCH 05/11] Add database adapter gems to test group --- Gemfile | 5 +++++ Gemfile.lock | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/Gemfile b/Gemfile index 4962c55d9..23f2f056a 100644 --- a/Gemfile +++ b/Gemfile @@ -16,6 +16,11 @@ group :test do gem "simplecov" gem "codeclimate-test-reporter", "~> 1.0.0" + # Databases + gem "pg" + gem "mysql2" + gem "sqlite3" + # System tests gem "capybara" gem "selenium-webdriver", "~> 4.11.0" diff --git a/Gemfile.lock b/Gemfile.lock index 0e7382acb..adff0a019 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -196,6 +196,7 @@ GEM mocha (2.1.0) ruby2_keywords (>= 0.0.5) mutex_m (0.2.0) + mysql2 (0.5.6) net-imap (0.4.9.1) date net-protocol @@ -209,6 +210,7 @@ GEM nokogiri (1.16.0) mini_portile2 (~> 2.8.2) racc (~> 1.4) + pg (1.5.8) pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) @@ -292,6 +294,8 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) + sqlite3 (2.1.0) + mini_portile2 (~> 2.8.0) stimulus-rails (1.3.3) railties (>= 6.0.0) stringio (3.1.0) @@ -328,12 +332,15 @@ DEPENDENCIES letter_opener minitest-reporters mocha + mysql2 + pg pry-rails puma rails-controller-testing selenium-webdriver (~> 4.11.0) simplecov spina! + sqlite3 BUNDLED WITH 2.4.18 From 00c6f236e097f52cc4d8d47b8736cf7ce751f0c7 Mon Sep 17 00:00:00 2001 From: Bram Jetten Date: Tue, 8 Oct 2024 21:50:50 +0200 Subject: [PATCH 06/11] Add SQLite database tests --- .github/workflows/ruby.yml | 45 +++++++++++++++++-- ...atabase.yml.ci => database.yml.postgresql} | 0 test/dummy/config/database.yml.sqlite | 8 ++++ 3 files changed, 50 insertions(+), 3 deletions(-) rename test/dummy/config/{database.yml.ci => database.yml.postgresql} (100%) create mode 100644 test/dummy/config/database.yml.sqlite diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 1fd8a72a8..f83df351b 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -7,11 +7,12 @@ on: branches: [ main ] jobs: - test: + test-postgresql: + name: Test on PostgreSQL runs-on: ubuntu-latest strategy: matrix: - ruby-version: ['3.2'] + ruby-version: ['3.3'] services: postgres: @@ -50,7 +51,7 @@ jobs: env: RAILS_ENV: test run: | - cp test/dummy/config/database.yml.ci test/dummy/config/database.yml + cp test/dummy/config/database.yml.postgresql test/dummy/config/database.yml bin/rails db:setup - name: Compile assets @@ -66,3 +67,41 @@ jobs: GIT_BRANCH: ${GITHUB_REF/refs\/heads\//} run: ./cc-test-reporter after-build -r ${{ secrets.CodeClimate }} if: github.ref == 'refs/heads/main' + + test-sqlite: + name: Test on SQLite + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: ['3.3'] + steps: + - uses: actions/checkout@v2 + + - name: Install libvips + run: sudo apt-get install -y libvips + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true + + - name: Install dependencies + run: bundle install + + - name: Create DB + env: + RAILS_ENV: test + run: | + cp test/dummy/config/database.yml.sqlite test/dummy/config/database.yml + bin/rails db:setup + + - name: Compile assets + env: + RAILS_ENV: test + run: bin/rails app:assets:precompile + + - name: Run tests + env: + RAILS_ENV: test + run: bin/rails test test/* diff --git a/test/dummy/config/database.yml.ci b/test/dummy/config/database.yml.postgresql similarity index 100% rename from test/dummy/config/database.yml.ci rename to test/dummy/config/database.yml.postgresql diff --git a/test/dummy/config/database.yml.sqlite b/test/dummy/config/database.yml.sqlite new file mode 100644 index 000000000..873cd3808 --- /dev/null +++ b/test/dummy/config/database.yml.sqlite @@ -0,0 +1,8 @@ +default: &default + adapter: sqlite3 + pool: 5 + timeout: 5000 + +test: + <<: *default + database: db/test.sqlite3 From 3504aad230c167a199ebd70bb116c2d549e09ccb Mon Sep 17 00:00:00 2001 From: Bram Jetten Date: Tue, 8 Oct 2024 21:56:26 +0200 Subject: [PATCH 07/11] Update Gemfile.lock --- Gemfile.lock | 318 +++++++++++++++++++++++++++++---------------------- 1 file changed, 183 insertions(+), 135 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index adff0a019..5bf16197e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -24,134 +24,140 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.1.2) - actionpack (= 7.1.2) - activesupport (= 7.1.2) + actioncable (7.2.1) + actionpack (= 7.2.1) + activesupport (= 7.2.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.2) - actionpack (= 7.1.2) - activejob (= 7.1.2) - activerecord (= 7.1.2) - activestorage (= 7.1.2) - activesupport (= 7.1.2) - mail (>= 2.7.1) - net-imap - net-pop - net-smtp - actionmailer (7.1.2) - actionpack (= 7.1.2) - actionview (= 7.1.2) - activejob (= 7.1.2) - activesupport (= 7.1.2) - mail (~> 2.5, >= 2.5.4) - net-imap - net-pop - net-smtp + actionmailbox (7.2.1) + actionpack (= 7.2.1) + activejob (= 7.2.1) + activerecord (= 7.2.1) + activestorage (= 7.2.1) + activesupport (= 7.2.1) + mail (>= 2.8.0) + actionmailer (7.2.1) + actionpack (= 7.2.1) + actionview (= 7.2.1) + activejob (= 7.2.1) + activesupport (= 7.2.1) + mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.1.2) - actionview (= 7.1.2) - activesupport (= 7.1.2) + actionpack (7.2.1) + actionview (= 7.2.1) + activesupport (= 7.2.1) nokogiri (>= 1.8.5) racc - rack (>= 2.2.4) + rack (>= 2.2.4, < 3.2) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.2) - actionpack (= 7.1.2) - activerecord (= 7.1.2) - activestorage (= 7.1.2) - activesupport (= 7.1.2) + useragent (~> 0.16) + actiontext (7.2.1) + actionpack (= 7.2.1) + activerecord (= 7.2.1) + activestorage (= 7.2.1) + activesupport (= 7.2.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.2) - activesupport (= 7.1.2) + actionview (7.2.1) + activesupport (= 7.2.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.1.2) - activesupport (= 7.1.2) + activejob (7.2.1) + activesupport (= 7.2.1) globalid (>= 0.3.6) - activemodel (7.1.2) - activesupport (= 7.1.2) - activerecord (7.1.2) - activemodel (= 7.1.2) - activesupport (= 7.1.2) + activemodel (7.2.1) + activesupport (= 7.2.1) + activerecord (7.2.1) + activemodel (= 7.2.1) + activesupport (= 7.2.1) timeout (>= 0.4.0) - activestorage (7.1.2) - actionpack (= 7.1.2) - activejob (= 7.1.2) - activerecord (= 7.1.2) - activesupport (= 7.1.2) + activestorage (7.2.1) + actionpack (= 7.2.1) + activejob (= 7.2.1) + activerecord (= 7.2.1) + activesupport (= 7.2.1) marcel (~> 1.0) - activesupport (7.1.2) + activesupport (7.2.1) base64 bigdecimal - concurrent-ruby (~> 1.0, >= 1.0.2) + concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - mutex_m - tzinfo (~> 2.0) - addressable (2.8.5) - public_suffix (>= 2.0.2, < 6.0) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) ancestry (4.3.3) activerecord (>= 5.2.6) ansi (1.5.0) - attr_json (2.3.0) - activerecord (>= 6.0.0, < 7.2) + attr_json (2.4.0) + activerecord (>= 6.0.0, < 7.3) babosa (2.0.0) base64 (0.2.0) bcrypt (3.1.20) - bigdecimal (3.1.5) + bigdecimal (3.1.8) breadcrumbs_on_rails (4.1.0) railties (>= 5.0) - browser (5.3.1) - builder (3.2.4) - capybara (3.39.2) + browser (6.0.0) + builder (3.3.0) + capybara (3.40.0) addressable matrix mini_mime (>= 0.1.3) - nokogiri (~> 1.8) + nokogiri (~> 1.11) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) + childprocess (5.1.0) + logger (~> 1.5) codeclimate-test-reporter (1.0.9) simplecov (<= 0.13) coderay (1.1.3) - concurrent-ruby (1.2.2) + concurrent-ruby (1.3.4) connection_pool (2.4.1) crass (1.0.6) date (3.3.4) docile (1.1.5) - drb (2.2.0) - ruby2_keywords - erubi (1.12.0) - factory_bot (6.3.0) + drb (2.2.1) + erubi (1.13.0) + factory_bot (6.5.0) activesupport (>= 5.0.0) - ffi (1.16.3) + ffi (1.17.0-aarch64-linux-gnu) + ffi (1.17.0-aarch64-linux-musl) + ffi (1.17.0-arm-linux-gnu) + ffi (1.17.0-arm-linux-musl) + ffi (1.17.0-arm64-darwin) + ffi (1.17.0-x86-linux-gnu) + ffi (1.17.0-x86-linux-musl) + ffi (1.17.0-x86_64-darwin) + ffi (1.17.0-x86_64-linux-gnu) + ffi (1.17.0-x86_64-linux-musl) globalid (1.2.1) activesupport (>= 6.1) - i18n (1.14.1) + i18n (1.14.6) concurrent-ruby (~> 1.0) - image_processing (1.12.2) + image_processing (1.13.0) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) - importmap-rails (2.0.1) + importmap-rails (2.0.2) actionpack (>= 6.0.0) activesupport (>= 6.0.0) railties (>= 6.0.0) - io-console (0.7.1) - irb (1.11.1) - rdoc + io-console (0.7.2) + irb (1.14.1) + rdoc (>= 4.0.0) reline (>= 0.4.2) - json (2.6.3) + json (2.7.2) jsonapi-serializer (2.2.0) activesupport (>= 4.2) kaminari (1.2.2) @@ -166,10 +172,12 @@ GEM activerecord kaminari-core (= 1.2.2) kaminari-core (1.2.2) - launchy (2.5.2) + launchy (3.0.1) addressable (~> 2.8) - letter_opener (1.8.1) - launchy (>= 2.2, < 3) + childprocess (~> 5.0) + letter_opener (1.10.0) + launchy (>= 2.2, < 4) + logger (1.6.1) loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -178,14 +186,13 @@ GEM net-imap net-pop net-smtp - marcel (1.0.2) + marcel (1.0.4) matrix (0.4.2) - method_source (1.0.0) - mini_magick (4.12.0) + method_source (1.1.0) + mini_magick (4.13.2) mini_mime (1.1.5) - mini_portile2 (2.8.5) - minitest (5.20.0) - minitest-reporters (1.6.1) + minitest (5.25.1) + minitest-reporters (1.7.1) ansi builder minitest (>= 5.0) @@ -193,36 +200,44 @@ GEM mobility (1.2.9) i18n (>= 0.6.10, < 2) request_store (~> 1.0) - mocha (2.1.0) + mocha (2.4.5) ruby2_keywords (>= 0.0.5) - mutex_m (0.2.0) mysql2 (0.5.6) - net-imap (0.4.9.1) + net-imap (0.4.16) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.4.0.1) + net-smtp (0.5.0) net-protocol - nio4r (2.7.0) - nokogiri (1.16.0) - mini_portile2 (~> 2.8.2) + nio4r (2.7.3) + nokogiri (1.16.7-aarch64-linux) + racc (~> 1.4) + nokogiri (1.16.7-arm-linux) + racc (~> 1.4) + nokogiri (1.16.7-arm64-darwin) + racc (~> 1.4) + nokogiri (1.16.7-x86-linux) + racc (~> 1.4) + nokogiri (1.16.7-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.16.7-x86_64-linux) racc (~> 1.4) pg (1.5.8) pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - pry-rails (0.3.9) - pry (>= 0.10.4) + pry-rails (0.3.11) + pry (>= 0.13.0) psych (5.1.2) stringio - public_suffix (5.0.3) - puma (6.4.0) + public_suffix (6.0.1) + puma (6.4.3) nio4r (~> 2.0) - racc (1.7.3) - rack (3.0.8) + racc (1.8.1) + rack (3.1.7) rack-rewrite (1.5.1) rack-session (2.0.0) rack (>= 3.0.0) @@ -231,20 +246,20 @@ GEM rackup (2.1.0) rack (>= 3) webrick (~> 1.8) - rails (7.1.2) - actioncable (= 7.1.2) - actionmailbox (= 7.1.2) - actionmailer (= 7.1.2) - actionpack (= 7.1.2) - actiontext (= 7.1.2) - actionview (= 7.1.2) - activejob (= 7.1.2) - activemodel (= 7.1.2) - activerecord (= 7.1.2) - activestorage (= 7.1.2) - activesupport (= 7.1.2) + rails (7.2.1) + actioncable (= 7.2.1) + actionmailbox (= 7.2.1) + actionmailer (= 7.2.1) + actionpack (= 7.2.1) + actiontext (= 7.2.1) + actionview (= 7.2.1) + activejob (= 7.2.1) + activemodel (= 7.2.1) + activerecord (= 7.2.1) + activestorage (= 7.2.1) + activesupport (= 7.2.1) bundler (>= 1.15.0) - railties (= 7.1.2) + railties (= 7.2.1) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -256,28 +271,30 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.1.2) - actionpack (= 7.1.2) - activesupport (= 7.1.2) - irb + railties (7.2.1) + actionpack (= 7.2.1) + activesupport (= 7.2.1) + irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) zeitwerk (~> 2.6) - rake (13.1.0) - rdoc (6.6.2) + rake (13.2.1) + rdoc (6.7.0) psych (>= 4.0.0) - regexp_parser (2.8.1) - reline (0.4.2) + regexp_parser (2.9.2) + reline (0.5.10) io-console (~> 0.5) - request_store (1.5.1) + request_store (1.7.0) rack (>= 1.4) - rexml (3.2.6) + rexml (3.3.8) ruby-progressbar (1.13.0) - ruby-vips (2.2.0) + ruby-vips (2.2.2) ffi (~> 1.12) + logger ruby2_keywords (0.0.5) rubyzip (2.3.2) + securerandom (0.3.1) selenium-webdriver (4.11.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) @@ -290,40 +307,71 @@ GEM sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) + sprockets-rails (3.5.2) + actionpack (>= 6.1) + activesupport (>= 6.1) sprockets (>= 3.0.0) - sqlite3 (2.1.0) - mini_portile2 (~> 2.8.0) - stimulus-rails (1.3.3) - railties (>= 6.0.0) - stringio (3.1.0) - tailwindcss-rails (2.2.1) + sqlite3 (2.1.0-aarch64-linux-gnu) + sqlite3 (2.1.0-aarch64-linux-musl) + sqlite3 (2.1.0-arm-linux-gnu) + sqlite3 (2.1.0-arm-linux-musl) + sqlite3 (2.1.0-arm64-darwin) + sqlite3 (2.1.0-x86-linux-gnu) + sqlite3 (2.1.0-x86-linux-musl) + sqlite3 (2.1.0-x86_64-darwin) + sqlite3 (2.1.0-x86_64-linux-gnu) + sqlite3 (2.1.0-x86_64-linux-musl) + stimulus-rails (1.3.4) railties (>= 6.0.0) - thor (1.3.0) + stringio (3.1.1) + tailwindcss-rails (2.7.8) + railties (>= 7.0.0) + tailwindcss-rails (2.7.8-aarch64-linux) + railties (>= 7.0.0) + tailwindcss-rails (2.7.8-arm-linux) + railties (>= 7.0.0) + tailwindcss-rails (2.7.8-arm64-darwin) + railties (>= 7.0.0) + tailwindcss-rails (2.7.8-x86_64-darwin) + railties (>= 7.0.0) + tailwindcss-rails (2.7.8-x86_64-linux) + railties (>= 7.0.0) + thor (1.3.2) timeout (0.4.1) - turbo-rails (2.0.1) + turbo-rails (2.0.10) actionpack (>= 6.0.0) - activejob (>= 6.0.0) railties (>= 6.0.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - view_component (3.10.0) + useragent (0.16.10) + view_component (3.17.0) activesupport (>= 5.2.0, < 8.0) concurrent-ruby (~> 1.0) method_source (~> 1.0) - webrick (1.8.1) - websocket (1.2.10) + webrick (1.8.2) + websocket (1.2.11) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.12) + zeitwerk (2.6.18) PLATFORMS - ruby + aarch64-linux + aarch64-linux-gnu + aarch64-linux-musl + arm-linux + arm-linux-gnu + arm-linux-musl + arm64-darwin + x86-linux + x86-linux-gnu + x86-linux-musl + x86_64-darwin + x86_64-linux + x86_64-linux-gnu + x86_64-linux-musl DEPENDENCIES capybara @@ -343,4 +391,4 @@ DEPENDENCIES sqlite3 BUNDLED WITH - 2.4.18 + 2.5.21 From c74906dfc98789655ce0fd87687fb943b9378cc9 Mon Sep 17 00:00:00 2001 From: Bram Jetten Date: Tue, 8 Oct 2024 22:03:00 +0200 Subject: [PATCH 08/11] Remove other test for now --- .github/workflows/ruby.yml | 40 +------------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index f83df351b..7086daf22 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -7,8 +7,7 @@ on: branches: [ main ] jobs: - test-postgresql: - name: Test on PostgreSQL + test: runs-on: ubuntu-latest strategy: matrix: @@ -68,40 +67,3 @@ jobs: run: ./cc-test-reporter after-build -r ${{ secrets.CodeClimate }} if: github.ref == 'refs/heads/main' - test-sqlite: - name: Test on SQLite - runs-on: ubuntu-latest - strategy: - matrix: - ruby-version: ['3.3'] - steps: - - uses: actions/checkout@v2 - - - name: Install libvips - run: sudo apt-get install -y libvips - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby-version }} - bundler-cache: true - - - name: Install dependencies - run: bundle install - - - name: Create DB - env: - RAILS_ENV: test - run: | - cp test/dummy/config/database.yml.sqlite test/dummy/config/database.yml - bin/rails db:setup - - - name: Compile assets - env: - RAILS_ENV: test - run: bin/rails app:assets:precompile - - - name: Run tests - env: - RAILS_ENV: test - run: bin/rails test test/* From 1afd0c8ceb09034259c1f22a1eae2d53ad5868a9 Mon Sep 17 00:00:00 2001 From: Bram Jetten Date: Tue, 8 Oct 2024 22:07:16 +0200 Subject: [PATCH 09/11] Use v4 --- .github/workflows/ruby.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 7086daf22..a88200c57 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -29,7 +29,7 @@ jobs: --health-retries 5 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install libvips run: sudo apt-get install -y libvips From 55b1798762c512d417a418c1d1e852988ad04738 Mon Sep 17 00:00:00 2001 From: Bram Jetten Date: Tue, 8 Oct 2024 22:09:17 +0200 Subject: [PATCH 10/11] lets revert back to ruby 3.2 for now --- .github/workflows/ruby.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index a88200c57..e292f34f5 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: ['3.3'] + ruby-version: ['3.2'] services: postgres: From 218c08e4131fab82e85c93d1225283b7496867e8 Mon Sep 17 00:00:00 2001 From: Bram Jetten Date: Tue, 8 Oct 2024 22:14:09 +0200 Subject: [PATCH 11/11] Fixtures --- test/test_helper.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index bd8df74d6..2c4ab1d23 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -20,11 +20,17 @@ class Minitest::Unit::TestCase FactoryBot.find_definitions # Load fixtures from the engine -if ActiveSupport::TestCase.respond_to?(:fixture_path=) - ActiveSupport::TestCase.fixture_path = File.expand_path("fixtures", __dir__) - ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path - ActiveSupport::TestCase.file_fixture_path = ActiveSupport::TestCase.fixture_path + "/files" - ActiveSupport::TestCase.fixtures :all +# if ActiveSupport::TestCase.respond_to?(:fixture_path=) +# ActiveSupport::TestCase.fixture_path = File.expand_path("fixtures", __dir__) +# ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path +# ActiveSupport::TestCase.file_fixture_path = ActiveSupport::TestCase.fixture_path + "/files" +# ActiveSupport::TestCase.fixtures :all +# end +class ActiveSupport::TestCase + self.fixture_path = File.expand_path('fixtures', __dir__) + self.file_fixture_path = fixture_path + '/files' + + fixtures :all end module AuthenticationHelper