From 3bd6a0decffe964964914e8421b516926c5f1c78 Mon Sep 17 00:00:00 2001 From: lgebhardt Date: Wed, 1 Nov 2023 09:10:39 -0400 Subject: [PATCH 1/4] Cleanup table definitions for Rails 7.1 --- test/fixtures/active_record.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/fixtures/active_record.rb b/test/fixtures/active_record.rb index 950a012b..c08aa896 100644 --- a/test/fixtures/active_record.rb +++ b/test/fixtures/active_record.rb @@ -52,7 +52,7 @@ end create_table :posts, force: true do |t| - t.string :title, length: 255 + t.string :title, limit: 255 t.text :body t.integer :author_id t.integer :parent_post_id @@ -311,8 +311,8 @@ create_table :things, force: true do |t| t.string :name - t.references :user - t.references :box + t.belongs_to :user + t.belongs_to :box t.timestamps null: false end @@ -324,8 +324,8 @@ create_table :related_things, force: true do |t| t.string :name - t.references :from, references: :thing - t.references :to, references: :thing + t.belongs_to :from + t.belongs_to :to t.timestamps null: false end From db633579cc654be079d17787cfa292acbcbebe9c Mon Sep 17 00:00:00 2001 From: lgebhardt Date: Wed, 1 Nov 2023 09:14:56 -0400 Subject: [PATCH 2/4] Test helper move require 'rails/test_help' --- test/test_helper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index 940d0755..31f391be 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -23,7 +23,6 @@ ENV['DATABASE_URL'] ||= "sqlite3:test_db" require 'active_record/railtie' -require 'rails/test_help' require 'minitest/mock' require 'jsonapi-resources' require 'pry' @@ -67,6 +66,8 @@ class TestApp < Rails::Application end end +require 'rails/test_help' + DatabaseCleaner.allow_remote_database_url = true DatabaseCleaner.strategy = :transaction From cacd02ea59afec773f23d7ef1ff968d31cf5ea0a Mon Sep 17 00:00:00 2001 From: lgebhardt Date: Wed, 1 Nov 2023 09:15:19 -0400 Subject: [PATCH 3/4] Test helper add `config.hosts` --- test/test_helper.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/test_helper.rb b/test/test_helper.rb index 31f391be..60c2fbed 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -64,6 +64,8 @@ class TestApp < Rails::Application if Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR == 2 config.active_record.sqlite3.represent_boolean_as_integer = true end + + config.hosts << "www.example.com" end require 'rails/test_help' From 58eb5dffc6856cad45a5c6fc735a64bc14735922 Mon Sep 17 00:00:00 2001 From: lgebhardt Date: Wed, 1 Nov 2023 09:27:53 -0400 Subject: [PATCH 4/4] Update test matrix to add rails 7.1 and remove ruby 2.6 Note: ruby 2.7 is also EOL, but I'm choosing to continue testing 2.7 for now --- .github/workflows/ruby.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 7534b022..858c6129 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -42,8 +42,8 @@ jobs: - '3.1' - '3.0' - '2.7' - - '2.6' rails: + - '7.1' - '7.0' - '6.1' - '6.0' @@ -60,8 +60,6 @@ jobs: rails: '5.1' - ruby: '3.0' rails: '6.0' - - ruby: '2.6' - rails: '7.0' env: RAILS_VERSION: ${{ matrix.rails }} DATABASE_URL: ${{ matrix.database_url }}