From c2ab69adc446e306f0e95333fc6b7fd7b8cc823b Mon Sep 17 00:00:00 2001 From: Carlos Palhares Date: Tue, 23 Jul 2024 18:46:17 -0300 Subject: [PATCH] Load trilogy adapter after rails --- Appraisals | 4 ++-- gemfiles/rails_6_1.gemfile | 2 +- gemfiles/rails_7_0.gemfile | 2 +- spec/spec_helper.rb | 8 ++++++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Appraisals b/Appraisals index a0bbd171..d18776e2 100644 --- a/Appraisals +++ b/Appraisals @@ -1,11 +1,11 @@ appraise 'rails-6-1' do + gem 'activerecord-trilogy-adapter', '>= 3.1.2', require: false gem 'rails', '6.1.7.6' - gem 'activerecord-trilogy-adapter', '>= 3.1.2' end appraise 'rails-7-0' do + gem 'activerecord-trilogy-adapter', '>= 3.1.2', require: false gem 'rails', '7.0.8' - gem 'activerecord-trilogy-adapter', '>= 3.1.2' end appraise 'rails-7-1' do diff --git a/gemfiles/rails_6_1.gemfile b/gemfiles/rails_6_1.gemfile index ce47b52c..a3bf085d 100644 --- a/gemfiles/rails_6_1.gemfile +++ b/gemfiles/rails_6_1.gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' -gem 'activerecord-trilogy-adapter', '>= 3.1.2' +gem 'activerecord-trilogy-adapter', '>= 3.1.2', require: false gem 'codeclimate-test-reporter', '~> 1.0.3', group: :test, require: nil gem 'rails', '6.1.7.6' gem 'rubocop', '~> 1.60.2', require: false diff --git a/gemfiles/rails_7_0.gemfile b/gemfiles/rails_7_0.gemfile index c533ee6b..06e086f7 100644 --- a/gemfiles/rails_7_0.gemfile +++ b/gemfiles/rails_7_0.gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' -gem 'activerecord-trilogy-adapter', '>= 3.1.2' +gem 'activerecord-trilogy-adapter', '>= 3.1.2', require: false gem 'codeclimate-test-reporter', '~> 1.0.3', group: :test, require: nil gem 'rails', '7.0.8' gem 'rubocop', '~> 1.60.2', require: false diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 21b167f6..43c979d5 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -20,7 +20,11 @@ db_config = Configuration.new -require "active_record/connection_adapters/#{db_config['original_adapter']}_adapter" +begin + require 'activerecord-trilogy-adapter' +rescue StandardError + puts "'activerecord-trilogy-adapter' not loaded for #{Rails.version}" +end # Disables/enables the queries log you see in your rails server in dev mode fd = ENV['VERBOSE'] ? STDOUT : '/dev/null' @@ -33,7 +37,7 @@ username: db_config['username'], password: db_config['password'], database: db_config['database'], - ssl_mode: "required" + ssl_mode: 'required' ) MIGRATION_FIXTURES = File.expand_path('../fixtures/migrate/', __FILE__)