File tree 2 files changed +6
-2
lines changed
2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,11 @@ describe "Avram::SaveOperation" do
66
66
operation.saved?.should be_true
67
67
end
68
68
end
69
+
70
+ it " releases connection after operation finishes and no transactions open" , tags: Avram ::SpecHelper ::TRUNCATE do
71
+ PostTransactionSaveOperation .create!(title: " New Title" , rollback_after_save: false )
72
+ TestDatabase .connections.should be_empty
73
+ end
69
74
end
70
75
71
76
describe " raising an error" do
Original file line number Diff line number Diff line change @@ -221,8 +221,7 @@ abstract class Avram::Database
221
221
rescue e : Avram ::Rollback
222
222
false
223
223
ensure
224
- # TODO: not sure of this
225
- if current_connection._avram_in_transaction?
224
+ if ! current_connection._avram_in_transaction?
226
225
current_connection.release
227
226
connections.delete(object_id)
228
227
end
You can’t perform that action at this time.
0 commit comments