test_after_commit 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -3,13 +3,3 @@ rvm:
3
3
  - ree
4
4
  - 1.9.3
5
5
  - 2.0.0
6
- gemfile:
7
- - gemfiles/30.gemfile
8
- - gemfiles/31.gemfile
9
- - gemfiles/32.gemfile
10
- - gemfiles/40.gemfile
11
- matrix:
12
- exclude:
13
- - rvm: ree
14
- gemfile: gemfiles/40.gemfile
15
- script: "bundle exec rake spec"
data/Appraisals CHANGED
@@ -10,7 +10,9 @@ appraise "32" do
10
10
  gem "activerecord", "~> 3.2.6"
11
11
  end
12
12
 
13
- appraise "40" do
14
- gem "activerecord", "~> 4.0.0.beta1"
15
- gem "rails-observers"
13
+ if RUBY_VERSION > "1.9.0"
14
+ appraise "40" do
15
+ gem "activerecord", "~> 4.0.0.beta1"
16
+ gem "rails-observers"
17
+ end
16
18
  end
data/Gemfile.lock CHANGED
@@ -1,29 +1,31 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- test_after_commit (0.1.1)
4
+ test_after_commit (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- activemodel (3.0.15)
10
- activesupport (= 3.0.15)
11
- builder (~> 2.1.2)
12
- i18n (~> 0.5.0)
13
- activerecord (3.0.15)
14
- activemodel (= 3.0.15)
15
- activesupport (= 3.0.15)
16
- arel (~> 2.0.10)
17
- tzinfo (~> 0.3.23)
18
- activesupport (3.0.15)
9
+ activemodel (3.2.13)
10
+ activesupport (= 3.2.13)
11
+ builder (~> 3.0.0)
12
+ activerecord (3.2.13)
13
+ activemodel (= 3.2.13)
14
+ activesupport (= 3.2.13)
15
+ arel (~> 3.0.2)
16
+ tzinfo (~> 0.3.29)
17
+ activesupport (3.2.13)
18
+ i18n (= 0.6.1)
19
+ multi_json (~> 1.0)
19
20
  appraisal (0.4.1)
20
21
  bundler
21
22
  rake
22
- arel (2.0.10)
23
- builder (2.1.2)
23
+ arel (3.0.2)
24
+ builder (3.0.4)
24
25
  bump (0.3.12)
25
26
  diff-lcs (1.2.1)
26
- i18n (0.5.0)
27
+ i18n (0.6.1)
28
+ multi_json (1.7.2)
27
29
  rake (0.9.2)
28
30
  rspec (2.13.0)
29
31
  rspec-core (~> 2.13.0)
@@ -34,7 +36,7 @@ GEM
34
36
  diff-lcs (>= 1.1.3, < 2.0)
35
37
  rspec-mocks (2.13.0)
36
38
  sqlite3 (1.3.6)
37
- tzinfo (0.3.33)
39
+ tzinfo (0.3.37)
38
40
 
39
41
  PLATFORMS
40
42
  ruby
data/gemfiles/30.gemfile CHANGED
@@ -3,6 +3,7 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "rake"
6
+ gem "bump"
6
7
  gem "rspec", "~>2"
7
8
  gem "sqlite3"
8
9
  gem "appraisal"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/mgrosser/code/tools/test_after_commit
3
3
  specs:
4
- test_after_commit (0.1.0)
4
+ test_after_commit (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -21,6 +21,7 @@ GEM
21
21
  rake
22
22
  arel (2.0.10)
23
23
  builder (2.1.2)
24
+ bump (0.4.0)
24
25
  diff-lcs (1.1.3)
25
26
  i18n (0.5.0)
26
27
  rake (0.9.2.2)
@@ -41,6 +42,7 @@ PLATFORMS
41
42
  DEPENDENCIES
42
43
  activerecord (~> 3.0.15)
43
44
  appraisal
45
+ bump
44
46
  rake
45
47
  rspec (~> 2)
46
48
  sqlite3
data/gemfiles/31.gemfile CHANGED
@@ -3,6 +3,7 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "rake"
6
+ gem "bump"
6
7
  gem "rspec", "~>2"
7
8
  gem "sqlite3"
8
9
  gem "appraisal"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/mgrosser/code/tools/test_after_commit
3
3
  specs:
4
- test_after_commit (0.1.0)
4
+ test_after_commit (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -22,6 +22,7 @@ GEM
22
22
  rake
23
23
  arel (2.2.3)
24
24
  builder (3.0.0)
25
+ bump (0.4.0)
25
26
  diff-lcs (1.1.3)
26
27
  i18n (0.6.0)
27
28
  multi_json (1.2.0)
@@ -43,6 +44,7 @@ PLATFORMS
43
44
  DEPENDENCIES
44
45
  activerecord (~> 3.1.6)
45
46
  appraisal
47
+ bump
46
48
  rake
47
49
  rspec (~> 2)
48
50
  sqlite3
data/gemfiles/32.gemfile CHANGED
@@ -3,6 +3,7 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "rake"
6
+ gem "bump"
6
7
  gem "rspec", "~>2"
7
8
  gem "sqlite3"
8
9
  gem "appraisal"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/mgrosser/code/tools/test_after_commit
3
3
  specs:
4
- test_after_commit (0.1.0)
4
+ test_after_commit (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -22,6 +22,7 @@ GEM
22
22
  rake
23
23
  arel (3.0.2)
24
24
  builder (3.0.0)
25
+ bump (0.4.0)
25
26
  diff-lcs (1.1.3)
26
27
  i18n (0.6.0)
27
28
  multi_json (1.3.6)
@@ -43,6 +44,7 @@ PLATFORMS
43
44
  DEPENDENCIES
44
45
  activerecord (~> 3.2.6)
45
46
  appraisal
47
+ bump
46
48
  rake
47
49
  rspec (~> 2)
48
50
  sqlite3
data/gemfiles/40.gemfile CHANGED
@@ -3,6 +3,7 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "rake"
6
+ gem "bump"
6
7
  gem "rspec", "~>2"
7
8
  gem "sqlite3"
8
9
  gem "appraisal"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/mgrosser/code/tools/test_after_commit
3
3
  specs:
4
- test_after_commit (0.1.0)
4
+ test_after_commit (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -33,6 +33,7 @@ GEM
33
33
  arel (4.0.0.beta2)
34
34
  atomic (1.0.1)
35
35
  builder (3.1.4)
36
+ bump (0.4.0)
36
37
  diff-lcs (1.2.1)
37
38
  erubis (2.7.0)
38
39
  i18n (0.6.4)
@@ -73,6 +74,7 @@ PLATFORMS
73
74
  DEPENDENCIES
74
75
  activerecord (~> 4.0.0.beta1)
75
76
  appraisal
77
+ bump
76
78
  rails-observers
77
79
  rake
78
80
  rspec (~> 2)
@@ -3,8 +3,6 @@ require 'test_after_commit/version'
3
3
  module TestAfterCommit
4
4
  end
5
5
 
6
- $PASS = 0
7
-
8
6
  ActiveRecord::ConnectionAdapters::DatabaseStatements.class_eval do
9
7
  def transaction_with_transactional_fixtures(*args)
10
8
  @test_open_transactions ||= 0
@@ -15,7 +13,7 @@ ActiveRecord::ConnectionAdapters::DatabaseStatements.class_eval do
15
13
  rescue ActiveRecord::Rollback => e
16
14
  raise e
17
15
  else
18
- if @test_open_transactions == 2
16
+ if @test_open_transactions == 1
19
17
  test_commit_records
20
18
  end
21
19
  result
@@ -1,3 +1,3 @@
1
1
  module TestAfterCommit
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.0'
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -10,8 +10,22 @@ end
10
10
  RSpec.configure do |config|
11
11
  unless ENV['REAL']
12
12
  config.around do |example|
13
- ActiveRecord::Base.transaction do # simulate transactional fixtures
14
- example.call
13
+ # open a transaction without using .transaction as activerecord use_transactional_fixtures does
14
+ if ActiveRecord::VERSION::MAJOR > 3
15
+ connection = ActiveRecord::Base.connection_handler.connection_pool_list.map(&:connection).first
16
+ connection.begin_transaction joinable: false
17
+ else
18
+ connection = ActiveRecord::Base.connection_handler.connection_pools.values.map(&:connection).first
19
+ connection.increment_open_transactions
20
+ connection.transaction_joinable = false
21
+ connection.begin_db_transaction
22
+ end
23
+
24
+ example.call
25
+
26
+ connection.rollback_db_transaction
27
+ if ActiveRecord::VERSION::MAJOR == 3
28
+ connection.decrement_open_transactions
15
29
  end
16
30
  end
17
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_after_commit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-21 00:00:00.000000000 Z
12
+ date: 2013-04-04 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: michael@grosser.it
@@ -52,7 +52,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
52
52
  version: '0'
53
53
  segments:
54
54
  - 0
55
- hash: -3932025956405055829
55
+ hash: 1962794305227048949
56
56
  required_rubygems_version: !ruby/object:Gem::Requirement
57
57
  none: false
58
58
  requirements:
@@ -61,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
61
  version: '0'
62
62
  segments:
63
63
  - 0
64
- hash: -3932025956405055829
64
+ hash: 1962794305227048949
65
65
  requirements: []
66
66
  rubyforge_project:
67
67
  rubygems_version: 1.8.25