From 54130a4c3fa576a6d647d0fec29c1381b80dbaf7 Mon Sep 17 00:00:00 2001 From: Joe Haines Date: Thu, 14 Dec 2023 12:45:05 +0000 Subject: [PATCH] Remove activerecord dependency --- features/fixtures/que/app/Gemfile | 1 - features/fixtures/que/app/setup-que.rb | 18 +++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/features/fixtures/que/app/Gemfile b/features/fixtures/que/app/Gemfile index 9257d550..930f3958 100644 --- a/features/fixtures/que/app/Gemfile +++ b/features/fixtures/que/app/Gemfile @@ -6,7 +6,6 @@ que_version = ENV.fetch("QUE_VERSION") gem "que", "~> #{que_version}" gem "pg", RUBY_VERSION < "2.2.0" ? "0.21.0" : "> 0.21.0" -gem "activerecord", RUBY_VERSION < "2.2.0" ? "4.2.11" : "> 4.2.11" # Install a compatible Minitest version on Ruby <2.3 gem 'minitest', '5.11.3' if RUBY_VERSION < '2.3.0' diff --git a/features/fixtures/que/app/setup-que.rb b/features/fixtures/que/app/setup-que.rb index d96f53f7..9cd334cf 100644 --- a/features/fixtures/que/app/setup-que.rb +++ b/features/fixtures/que/app/setup-que.rb @@ -2,7 +2,6 @@ require 'que' require 'socket' require 'bugsnag' -require 'active_record' QUE_VERSION = ENV.fetch("QUE_VERSION") @@ -30,15 +29,20 @@ raise 'postgres was not ready in time!' unless postgres_ready -ActiveRecord::Base.establish_connection( - adapter: 'postgresql', - database: 'postgres', - username: 'postgres', +connection = PG::Connection.open( + host: 'postgres', + user: 'postgres', password: 'test_password', - host: 'postgres' + dbname: 'postgres' ) -Que.connection = ActiveRecord +if QUE_VERSION < '1' + Que.connection = connection +else + Que.connection_proc = do |block| + block.call(connection) + end +end # Workaround a bug in que/pg # see https://github.com/que-rb/que/issues/247