Skip to content

Commit 5d049b2

Browse files
committed
add txn tests
1 parent d249da6 commit 5d049b2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

spec/statement_timeout_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@
171171
expect(subject.statement_timeout('1s') { connection.execute('select 1 as value')[0]['value'] }).to eq 1
172172
end
173173

174+
it 'should begin a transaction' do
175+
expect(subject.statement_timeout('1s') { |conn| conn.current_transaction.open? }).to be true
176+
end
177+
174178
it 'should support transaction' do
175179
expect { subject.statement_timeout('1s') { subject.transaction { subject.unscoped.take } } }
176180
.to_not raise_error
@@ -347,6 +351,10 @@
347351
expect(subject.statement_timeout('1s') { connection.execute('select 1 as value')[0]['value'] }).to eq 1
348352
end
349353

354+
it 'should not begin a transaction' do
355+
expect(subject.statement_timeout('1s') { |conn| conn.current_transaction.open? }).to be false
356+
end
357+
350358
it 'should support transaction' do
351359
expect { subject.statement_timeout('1s') { subject.transaction { subject.unscoped.take } } }
352360
.to_not raise_error

0 commit comments

Comments
 (0)