From ec9deb64ea52a6e5dc7c71dea12608b61667d1ee Mon Sep 17 00:00:00 2001 From: "Andrew N. Shalaev" Date: Thu, 28 Apr 2022 13:51:01 +0500 Subject: [PATCH] fix: avoid WARNING: there is no transaction in progress https://jira.railsc.ru/browse/BPC-20518 --- lib/treasury/storage/postgre_sql/base.rb | 3 +-- spec/lib/treasury/storage/postgre_sql/db_spec.rb | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/treasury/storage/postgre_sql/base.rb b/lib/treasury/storage/postgre_sql/base.rb index 50468f7..dee1893 100644 --- a/lib/treasury/storage/postgre_sql/base.rb +++ b/lib/treasury/storage/postgre_sql/base.rb @@ -26,8 +26,7 @@ module PostgreSQL # module Base def start_transaction - return if transaction_started? - return unless connection.transaction_open? + return if transaction_started? || connection.transaction_open? internal_start_transaction super diff --git a/spec/lib/treasury/storage/postgre_sql/db_spec.rb b/spec/lib/treasury/storage/postgre_sql/db_spec.rb index 2c80e78..0eadaa1 100644 --- a/spec/lib/treasury/storage/postgre_sql/db_spec.rb +++ b/spec/lib/treasury/storage/postgre_sql/db_spec.rb @@ -34,7 +34,6 @@ context 'when shared' do it do - expect(connection).to receive(:execute).ordered.with('BEGIN') expect(connection).to receive(:execute).ordered.with('LOCK TABLE "test_table" IN SHARE MODE') expect { storage.lock }.not_to raise_error end