@@ -6,34 +6,31 @@ class TransactionTestSQLServer < ActiveRecord::TestCase
66
77 self . use_transactional_fixtures = false
88
9- setup : delete_ships
9+ before { delete_ships }
1010
11- context 'Testing transaction basics' do
11+ it 'allow ActiveRecord::Rollback to work in 1 transaction block' do
12+ Ship . transaction do
13+ Ship . create! name : 'Black Pearl'
14+ raise ActiveRecord ::Rollback
15+ end
16+ assert_no_ships
17+ end
1218
13- should 'allow ActiveRecord::Rollback to work in 1 transaction block' do
19+ it 'allow nested transactions to totally rollback' do
20+ begin
1421 Ship . transaction do
1522 Ship . create! name : 'Black Pearl'
16- raise ActiveRecord ::Rollback
17- end
18- assert_no_ships
19- end
20-
21- should 'allow nested transactions to totally rollback' do
22- begin
2323 Ship . transaction do
24- Ship . create! name : 'Black Pearl'
25- Ship . transaction do
26- Ship . create! name : 'Flying Dutchman'
27- raise 'HELL'
28- end
24+ Ship . create! name : 'Flying Dutchman'
25+ raise 'HELL'
2926 end
30- rescue Exception => e
31- assert_no_ships
3227 end
28+ rescue Exception => e
29+ assert_no_ships
3330 end
34-
3531 end
3632
33+
3734 protected
3835
3936 def delete_ships
@@ -45,20 +42,3 @@ def assert_no_ships
4542 end
4643
4744end
48-
49- class TransactionTest < ActiveRecord ::TestCase
50- include ARTest ::SQLServer ::CoercedTest
51-
52- COERCED_TESTS = [ :test_releasing_named_savepoints ]
53-
54- def test_coerced_releasing_named_savepoints
55- Topic . transaction do
56- Topic . connection . create_savepoint ( "another" )
57- Topic . connection . release_savepoint ( "another" )
58-
59- # The origin rails test tries to re-release the savepoint, but
60- # since sqlserver doesn't have the concept of releasing, it doesn't
61- # fail, so we just omit that part here
62- end
63- end
64- end
0 commit comments