after_commit_action 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9222b7ce5f9538d3823646319cdfd4a0a005d918
4
- data.tar.gz: f6eca3b15daccf6681d58cc9dbcaf5e8bc8a53f8
3
+ metadata.gz: b0cf66f96dab729a49d3f3725988f5b4a5b2a67d
4
+ data.tar.gz: a59dde34fd240cca5a5dde13720e637227bbec7d
5
5
  SHA512:
6
- metadata.gz: 180205c0f74beb5fa377322dee5f68a2b748fb9301c35f1038c802ba6b74a82519427befb2477cd87b38b7269d07396c7e36ee5080fe189aa59fc4cd7b936c37
7
- data.tar.gz: 40a229846a306df184fa56a573592500a43f6058dad311b0bdb6a208821634a4b7d7a30b75acc7d781f914b86770d401f993fbeac24d386dbfacc53b9e82f998
6
+ metadata.gz: 23f2e9005b03c1b5c1ef5934beffa92c15a863ad731a7844e8f29e42d58aa6ad2d48a723e1930a05167e09b83d0182ddcbf130f527494da9d355ac5419de4759
7
+ data.tar.gz: e74bd535a30d455244782abfca0bc735304f918d879c2a83906979c9f48ed3ef256698d99bb03078cf68bbd57b81545b6ba21677d9712607e001b14a8f515c6c
data/Gemfile CHANGED
@@ -12,11 +12,11 @@ end
12
12
  group :development do
13
13
  gem "rdoc", "~> 3.12"
14
14
  gem "bundler", ">= 1.1.3"
15
- gem "jeweler", "~> 2.0.1"
15
+ gem "jeweler"
16
16
  end
17
17
 
18
18
  group :development, :test do
19
- gem "rspec", "~> 2.8.0"
19
+ gem "rspec"
20
20
  gem "sqlite3"
21
21
  gem "rspec-extra-formatters"
22
22
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.1.0
@@ -2,18 +2,18 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: after_commit_action 1.0.1 ruby lib
5
+ # stub: after_commit_action 1.1.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
- s.name = "after_commit_action"
9
- s.version = "1.0.1"
8
+ s.name = "after_commit_action".freeze
9
+ s.version = "1.1.0"
10
10
 
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.require_paths = ["lib"]
13
- s.authors = ["BestVendor"]
14
- s.date = "2016-01-13"
15
- s.description = "Use this module to defer actions to the after-commit hook. This is useful if you want to trigger actions in after_create, after_destroy and after_update callbacks but want to execute them outside of the transaction (for example, to avoid deadlocks)."
16
- s.email = "magnus@bestvendor.com"
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib".freeze]
13
+ s.authors = ["BestVendor".freeze]
14
+ s.date = "2017-07-19"
15
+ s.description = "Use this module to defer actions to the after-commit hook. This is useful if you want to trigger actions in after_create, after_destroy and after_update callbacks but want to execute them outside of the transaction (for example, to avoid deadlocks).".freeze
16
+ s.email = "magnus@bestvendor.com".freeze
17
17
  s.extra_rdoc_files = [
18
18
  "LICENSE.txt",
19
19
  "README.md"
@@ -85,45 +85,45 @@ Gem::Specification.new do |s|
85
85
  "spec/schema.rb",
86
86
  "spec/spec_helper.rb"
87
87
  ]
88
- s.homepage = "http://github.com/magnusvk/after_commit_action"
89
- s.licenses = ["MIT"]
90
- s.rubygems_version = "2.2.2"
91
- s.summary = "Easily defer blocks of code to the after-commit action of an ActiveRecord model."
88
+ s.homepage = "http://github.com/magnusvk/after_commit_action".freeze
89
+ s.licenses = ["MIT".freeze]
90
+ s.rubygems_version = "2.6.10".freeze
91
+ s.summary = "Easily defer blocks of code to the after-commit action of an ActiveRecord model.".freeze
92
92
 
93
93
  if s.respond_to? :specification_version then
94
94
  s.specification_version = 4
95
95
 
96
96
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
97
- s.add_runtime_dependency(%q<activerecord>, [">= 3.0.0"])
98
- s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0"])
99
- s.add_development_dependency(%q<rails>, [">= 0"])
100
- s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
101
- s.add_development_dependency(%q<bundler>, [">= 1.1.3"])
102
- s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
103
- s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
104
- s.add_development_dependency(%q<sqlite3>, [">= 0"])
105
- s.add_development_dependency(%q<rspec-extra-formatters>, [">= 0"])
97
+ s.add_runtime_dependency(%q<activerecord>.freeze, [">= 3.0.0"])
98
+ s.add_runtime_dependency(%q<activesupport>.freeze, [">= 3.0.0"])
99
+ s.add_development_dependency(%q<rails>.freeze, [">= 0"])
100
+ s.add_development_dependency(%q<rdoc>.freeze, ["~> 3.12"])
101
+ s.add_development_dependency(%q<bundler>.freeze, [">= 1.1.3"])
102
+ s.add_development_dependency(%q<jeweler>.freeze, [">= 0"])
103
+ s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
104
+ s.add_development_dependency(%q<sqlite3>.freeze, [">= 0"])
105
+ s.add_development_dependency(%q<rspec-extra-formatters>.freeze, [">= 0"])
106
106
  else
107
- s.add_dependency(%q<activerecord>, [">= 3.0.0"])
108
- s.add_dependency(%q<activesupport>, [">= 3.0.0"])
109
- s.add_dependency(%q<rails>, [">= 0"])
110
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
111
- s.add_dependency(%q<bundler>, [">= 1.1.3"])
112
- s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
113
- s.add_dependency(%q<rspec>, ["~> 2.8.0"])
114
- s.add_dependency(%q<sqlite3>, [">= 0"])
115
- s.add_dependency(%q<rspec-extra-formatters>, [">= 0"])
107
+ s.add_dependency(%q<activerecord>.freeze, [">= 3.0.0"])
108
+ s.add_dependency(%q<activesupport>.freeze, [">= 3.0.0"])
109
+ s.add_dependency(%q<rails>.freeze, [">= 0"])
110
+ s.add_dependency(%q<rdoc>.freeze, ["~> 3.12"])
111
+ s.add_dependency(%q<bundler>.freeze, [">= 1.1.3"])
112
+ s.add_dependency(%q<jeweler>.freeze, [">= 0"])
113
+ s.add_dependency(%q<rspec>.freeze, [">= 0"])
114
+ s.add_dependency(%q<sqlite3>.freeze, [">= 0"])
115
+ s.add_dependency(%q<rspec-extra-formatters>.freeze, [">= 0"])
116
116
  end
117
117
  else
118
- s.add_dependency(%q<activerecord>, [">= 3.0.0"])
119
- s.add_dependency(%q<activesupport>, [">= 3.0.0"])
120
- s.add_dependency(%q<rails>, [">= 0"])
121
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
122
- s.add_dependency(%q<bundler>, [">= 1.1.3"])
123
- s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
124
- s.add_dependency(%q<rspec>, ["~> 2.8.0"])
125
- s.add_dependency(%q<sqlite3>, [">= 0"])
126
- s.add_dependency(%q<rspec-extra-formatters>, [">= 0"])
118
+ s.add_dependency(%q<activerecord>.freeze, [">= 3.0.0"])
119
+ s.add_dependency(%q<activesupport>.freeze, [">= 3.0.0"])
120
+ s.add_dependency(%q<rails>.freeze, [">= 0"])
121
+ s.add_dependency(%q<rdoc>.freeze, ["~> 3.12"])
122
+ s.add_dependency(%q<bundler>.freeze, [">= 1.1.3"])
123
+ s.add_dependency(%q<jeweler>.freeze, [">= 0"])
124
+ s.add_dependency(%q<rspec>.freeze, [">= 0"])
125
+ s.add_dependency(%q<sqlite3>.freeze, [">= 0"])
126
+ s.add_dependency(%q<rspec-extra-formatters>.freeze, [">= 0"])
127
127
  end
128
128
  end
129
129
 
@@ -17,10 +17,10 @@ module AfterCommitAction
17
17
  end
18
18
 
19
19
  def execute_after_commit(&block)
20
- if ActiveRecord::Base.connection.open_transactions == 0
20
+ if self.class.connection.open_transactions == 0
21
21
  return block.call
22
22
  else
23
- ActiveRecord::Base.connection.add_transaction_record(self)
23
+ self.class.connection.add_transaction_record(self)
24
24
  end
25
25
 
26
26
  @_execute_after_commit ||= []
@@ -6,18 +6,18 @@ require 'models/another_model'
6
6
  describe "AfterCommitAction" do
7
7
  it "should correctly execute tasks after commit" do
8
8
  t = Tester.new
9
- t.array.should be_empty
9
+ expect(t.array).to be_empty
10
10
  t.save!
11
- t.array.size.should == 2
12
- t.array.should include('before_create')
13
- t.array.should include('after_create')
11
+ expect(t.array.size).to eq(2)
12
+ expect(t.array).to include('before_create')
13
+ expect(t.array).to include('after_create')
14
14
 
15
15
  t = Tester.first
16
- t.array.should be_empty
16
+ expect(t.array).to be_empty
17
17
  t.save!
18
- t.array.size.should == 2
19
- t.array.should include('before_update')
20
- t.array.should include('after_update')
18
+ expect(t.array.size).to eq(2)
19
+ expect(t.array).to include('before_update')
20
+ expect(t.array).to include('after_update')
21
21
  end
22
22
 
23
23
  context 'when block is executed in another model transaction' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: after_commit_action
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - BestVendor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-13 00:00:00.000000000 Z
11
+ date: 2017-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -84,30 +84,30 @@ dependencies:
84
84
  name: jeweler
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 2.0.1
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 2.0.1
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 2.8.0
103
+ version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 2.8.0
110
+ version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: sqlite3
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -231,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
231
231
  version: '0'
232
232
  requirements: []
233
233
  rubyforge_project:
234
- rubygems_version: 2.2.2
234
+ rubygems_version: 2.6.10
235
235
  signing_key:
236
236
  specification_version: 4
237
237
  summary: Easily defer blocks of code to the after-commit action of an ActiveRecord