test_after_commit 1.1.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/Readme.md +1 -0
- data/lib/test_after_commit/database_statements.rb +12 -10
- data/lib/test_after_commit/version.rb +1 -1
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9e954a2092e6459d8aa847d25003d59a5e1e9585a49a1adac385bdfe53be73d7
|
4
|
+
data.tar.gz: 8ba8118b026b6ef014ab6a4193b3f9a6929ec565bd6c6f6d84136eaea0cbf97a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 606b5057593a1299bfa01093635b6111b2eca9b1c58fe979caaac2492fc8ae4c2aa0dbe1cd2e3dd39c21f0bff13e4644d14d9aad48aa93e267a5e673b8bb5128
|
7
|
+
data.tar.gz: 42502f70417505aba857cbe8fd8e175ec737bc6923ecfe65af8e8cc706ae526c3b5c316fce1d7483b7fd2f4942cfa83a9b99039349ab0f82804159b22385c3c2
|
data/Readme.md
CHANGED
@@ -71,6 +71,7 @@ Inspired by https://gist.github.com/1305285
|
|
71
71
|
- [Brian Palmer](https://github.com/codekitchen)
|
72
72
|
- [Oleg Dashevskii](https://github.com/be9)
|
73
73
|
- [Jonathan Spies](https://github.com/jspies)
|
74
|
+
- [Nick Sieger](https://github.com/nicksieger)
|
74
75
|
|
75
76
|
[Michael Grosser](http://grosser.it)<br/>
|
76
77
|
michael@grosser.it<br/>
|
@@ -1,6 +1,9 @@
|
|
1
1
|
module TestAfterCommit::DatabaseStatements
|
2
2
|
def transaction(*)
|
3
3
|
@test_open_transactions ||= 0
|
4
|
+
skip_emulation = ActiveRecord::Base.connection.open_transactions.zero?
|
5
|
+
run_callbacks = false
|
6
|
+
result = nil
|
4
7
|
|
5
8
|
super do
|
6
9
|
begin
|
@@ -13,20 +16,19 @@ module TestAfterCommit::DatabaseStatements
|
|
13
16
|
rolled_back = true
|
14
17
|
raise
|
15
18
|
ensure
|
16
|
-
|
17
|
-
|
18
|
-
if
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
@_current_transaction_records.clear
|
23
|
-
end
|
19
|
+
@test_open_transactions -= 1
|
20
|
+
if @test_open_transactions == 0 && !rolled_back && !skip_emulation
|
21
|
+
if TestAfterCommit.enabled
|
22
|
+
run_callbacks = true
|
23
|
+
elsif ActiveRecord::VERSION::MAJOR == 3
|
24
|
+
@_current_transaction_records.clear
|
24
25
|
end
|
25
|
-
ensure
|
26
|
-
result
|
27
26
|
end
|
28
27
|
end
|
29
28
|
end
|
29
|
+
ensure
|
30
|
+
test_commit_records if run_callbacks
|
31
|
+
result
|
30
32
|
end
|
31
33
|
|
32
34
|
def test_commit_records
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_after_commit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -17,6 +17,9 @@ dependencies:
|
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.2'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.0'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -24,6 +27,9 @@ dependencies:
|
|
24
27
|
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '3.2'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.0'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: wwtd
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
132
|
version: '0'
|
127
133
|
requirements: []
|
128
134
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.
|
135
|
+
rubygems_version: 2.7.6
|
130
136
|
signing_key:
|
131
137
|
specification_version: 4
|
132
138
|
summary: makes after_commit callbacks testable in Rails 3+ with transactional_fixtures
|