-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Rails 7.1 testing #35
Changes from 10 commits
b095881
eaec3d9
436136a
29cdd29
3919d8e
259b3fc
3935b0a
6672557
ca9640a
50c4e72
fb6b937
efde80b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.7.5 | ||
3.2.2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
source 'https://rubygems.org' | ||
|
||
gemspec |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
begin | ||
require 'bundler/setup' | ||
rescue LoadError | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module Journaled::Actor | ||
extend ActiveSupport::Concern | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module Journaled::Changes | ||
extend ActiveSupport::Concern | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
class Journaled::ActorUriProvider | ||
include Singleton | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
class Journaled::Change | ||
include Journaled::Event | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
class Journaled::ChangeWriter | ||
attr_reader :model, :change_definition | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module Journaled::Event | ||
extend ActiveSupport::Concern | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
class Journaled::NotTrulyExceptionalError < RuntimeError | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
class Journaled::Writer | ||
EVENT_METHOD_NAMES = %i( | ||
journaled_schema_name | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
# frozen_string_literal: true | ||
|
||
Spring.application_root = './spec/dummy' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
# This file was generated by Appraisal | ||
|
||
source "https://rubygems.org" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
# This file was generated by Appraisal | ||
|
||
source "https://rubygems.org" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
# This file was generated by Appraisal | ||
|
||
source "https://rubygems.org" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
# This file was generated by Appraisal | ||
|
||
source "https://rubygems.org" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
# This file was generated by Appraisal | ||
|
||
source "https://rubygems.org" | ||
|
||
gem "railties", "~> 7.1.0" | ||
|
||
gemspec path: "../" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
require "aws-sdk-kinesis" | ||
require "active_job" | ||
require "json-schema" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'active_support/core_ext/module/attribute_accessors_per_thread' | ||
|
||
module Journaled | ||
|
@@ -52,7 +54,7 @@ def without_audit_logging | |
private | ||
|
||
def zeitwerk_exclude!(name) | ||
name.constantize.skip_audit_log if Object.const_defined?(name) | ||
name.constantize.skip_audit_log if Object.const_defined?(name) && !independent_class_in_7_1?(name) | ||
Rails.autoloaders.main.on_load(name) { |klass, _path| klass.skip_audit_log } | ||
end | ||
|
||
|
@@ -61,6 +63,14 @@ def classic_exclude!(name) | |
rescue NameError | ||
nil | ||
end | ||
|
||
def independent_class_in_7_1?(name) | ||
return false if Gem::Version.new(Rails.version) < Gem::Version.new('7.1') | ||
|
||
# These classes do not inherit from ActiveRecord::Base in 7.1 | ||
# so calling `skip_audit_log` on them will raise. | ||
%w(ActiveRecord::InternalMetadata ActiveRecord::SchemaMigration).include?(name) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am assuming the original reason for skipping these was that we didn't want them to have the callbacks defined in this module, but that they would have them because we There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it make sense to exclude these from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (And, yeah, that was the goal. If they don't inherit, then they don't need to be included.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alternatively, we could check There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes total sense; I updated the const's assignment and removed this method! I felt like inlining the array for both branches of the if-expr wasn't that bad/verbose (and decided to drop it by a line to avoid having a huge indent). |
||
end | ||
end | ||
|
||
Config = Struct.new(:enabled, :ignored_columns, :enqueue_opts) do | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module Journaled | ||
module Connection | ||
class << self | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module Journaled | ||
class Current < ActiveSupport::CurrentAttributes | ||
attribute :tags | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module Journaled | ||
class Engine < ::Rails::Engine | ||
config.after_initialize do | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module Journaled | ||
class TransactionSafetyError < StandardError; end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'active_record/connection_adapters/abstract/transaction' | ||
|
||
module Journaled | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module Journaled | ||
VERSION = "5.3.1".freeze | ||
VERSION = "5.3.2" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm only bumping patch because our actual dependencies were already sitting on 7.1 versions and I'm not dropping support for anything. We simply didn't actually test them in CI. |
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) | ||
load Gem.bin_path('bundler', 'bundle') |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
APP_PATH = File.expand_path('../config/application', __dir__) | ||
require_relative '../config/boot' | ||
require 'rails/commands' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
require_relative '../config/boot' | ||
require 'rake' | ||
Rake.application.run |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
require File.expand_path('boot', __dir__) | ||
|
||
require "active_record/railtie" | ||
|
@@ -12,6 +14,6 @@ module Dummy | |
class Application < Rails::Application | ||
config.autoloader = Rails::VERSION::MAJOR >= 7 ? :zeitwerk : :classic | ||
config.active_record.sqlite3.represent_boolean_as_integer = true if Rails::VERSION::MAJOR < 6 | ||
config.active_record.legacy_connection_handling = false if Rails::VERSION::MAJOR >= 7 | ||
config.active_record.legacy_connection_handling = false if Rails::VERSION::MAJOR == 7 && Rails::VERSION::MINOR == 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This setting was removed in 7.1. |
||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
# Load the Rails application. | ||
require File.expand_path('application', __dir__) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
# Be sure to restart your server when you modify this file. | ||
|
||
Rails.application.config.action_dispatch.cookies_serializer = :json |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
# Be sure to restart your server when you modify this file. | ||
|
||
Rails.application.config.session_store :cookie_store, key: '_dummy_session' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was facing some CI troubles when this was unpinned, e.g. https://github.com/Betterment/journaled/actions/runs/8727969396/job/23946685922. I'm guessing this hadn't surfaced before because the newer versions didn't exist(?)