delayed_job 2.0.0 → 2.0.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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.0.1
data/delayed_job.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{delayed_job}
8
- s.version = "2.0.0"
8
+ s.version = "2.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brandon Keepers", "Tobias L\303\274tke"]
@@ -31,7 +31,7 @@ module Delayed
31
31
  named_scope :by_priority, :order => 'priority ASC, run_at ASC'
32
32
 
33
33
  def self.after_fork
34
- ActiveRecord::Base.connection.reconnect!
34
+ ::ActiveRecord::Base.connection.reconnect!
35
35
  end
36
36
 
37
37
  # When a worker is exiting, make sure we don't have any locked jobs.
@@ -35,5 +35,12 @@ describe Delayed::Backend::ActiveRecord::Job do
35
35
  ActiveRecord::Base.default_timezone = :local
36
36
  %w(CST CDT).should include(Delayed::Backend::ActiveRecord::Job.db_time_now.zone)
37
37
  end
38
- end
38
+ end
39
+
40
+ describe "after_fork" do
41
+ it "should call reconnect on the connection" do
42
+ ActiveRecord::Base.connection.should_receive(:reconnect!)
43
+ Delayed::Backend::ActiveRecord::Job.after_fork
44
+ end
45
+ end
39
46
  end
@@ -66,4 +66,29 @@ describe Delayed::Backend::MongoMapper::Job do
66
66
  job.payload_object.perform.should == 'Epilog: Once upon a time...'
67
67
  end
68
68
  end
69
+
70
+ describe "before_fork" do
71
+ after do
72
+ MongoMapper.connection.connect_to_master
73
+ end
74
+
75
+ it "should disconnect" do
76
+ lambda do
77
+ Delayed::Backend::MongoMapper::Job.before_fork
78
+ end.should change { !!MongoMapper.connection.connected? }.from(true).to(false)
79
+ end
80
+ end
81
+
82
+ describe "after_fork" do
83
+ before do
84
+ MongoMapper.connection.close
85
+ end
86
+
87
+ it "should call reconnect" do
88
+ lambda do
89
+ Delayed::Backend::MongoMapper::Job.after_fork
90
+ end.should change { !!MongoMapper.connection.connected? }.from(false).to(true)
91
+ end
92
+ end
93
+
69
94
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 2
7
7
  - 0
8
- - 0
9
- version: 2.0.0
8
+ - 1
9
+ version: 2.0.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Brandon Keepers