delayed_job_shallow_mongoid 0.5.0 → 0.5.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/CHANGELOG.md +6 -0
- data/delayed_job_shallow_mongoid.gemspec +18 -38
- data/lib/delayed/shallow_mongoid.rb +15 -3
- data/lib/delayed/shallow_mongoid/performable_mailer.rb +5 -7
- data/lib/delayed/shallow_mongoid/performable_method.rb +4 -7
- data/lib/delayed/shallow_mongoid/version.rb +5 -0
- data/lib/delayed_job_shallow_mongoid.rb +1 -0
- metadata +24 -7
- data/VERSION +0 -2
- data/lib/delayed/performable_mailer.rb +0 -7
- data/spec/delayed_job_shallow_mongoid_spec.rb +0 -176
- data/spec/spec_helper.rb +0 -21
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
0.5.1
|
2
|
+
-----
|
3
|
+
|
4
|
+
* [#4](https://github.com/joeyAghion/delayed_job_shallow_mongoid/pull/4): Fix: `const_missing: uninitialized constant Delayed::DelayMail (NameError)` with Rails - [@dblock](http://github.com/dblock).
|
5
|
+
* [#4](https://github.com/joeyAghion/delayed_job_shallow_mongoid/pull/4): Fix: do not run job when a Mongoid instance is not found within delayed_job arguments and `Mongoid.raise_not_found_error` is set to `false` - [@dblock](http://github.com/dblock).
|
6
|
+
|
1
7
|
0.5.0
|
2
8
|
-----
|
3
9
|
|
@@ -1,11 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'delayed/shallow_mongoid/version'
|
6
|
+
|
2
7
|
Gem::Specification.new do |s|
|
3
8
|
s.name = "delayed_job_shallow_mongoid"
|
4
|
-
s.version =
|
9
|
+
s.version = Delayed::ShallowMongoid::VERSION
|
5
10
|
|
6
|
-
s.
|
7
|
-
s.authors = ["Joey Aghion"]
|
8
|
-
s.date = "2012-11-19"
|
11
|
+
s.authors = ["Joey Aghion", "Daniel Doubrovkine"]
|
9
12
|
s.description = "When the object or arg to a delayed_job is a Mongoid document, store only a small stub of the object instead of the full serialization."
|
10
13
|
s.email = "joey@aghion.com"
|
11
14
|
s.extra_rdoc_files = [
|
@@ -20,50 +23,27 @@ Gem::Specification.new do |s|
|
|
20
23
|
"LICENSE.txt",
|
21
24
|
"README.md",
|
22
25
|
"Rakefile",
|
23
|
-
"VERSION",
|
24
26
|
"delayed_job_shallow_mongoid.gemspec",
|
25
|
-
"lib/delayed/performable_mailer.rb",
|
26
27
|
"lib/delayed/shallow_mongoid.rb",
|
27
28
|
"lib/delayed/shallow_mongoid/document_stub.rb",
|
28
29
|
"lib/delayed/shallow_mongoid/performable_mailer.rb",
|
29
30
|
"lib/delayed/shallow_mongoid/performable_method.rb",
|
30
|
-
"lib/
|
31
|
-
"
|
32
|
-
"spec/spec_helper.rb"
|
31
|
+
"lib/delayed/shallow_mongoid/version.rb",
|
32
|
+
"lib/delayed_job_shallow_mongoid.rb"
|
33
33
|
]
|
34
34
|
s.homepage = "http://github.com/joeyAghion/delayed_job_shallow_mongoid"
|
35
35
|
s.licenses = ["MIT"]
|
36
36
|
s.require_paths = ["lib"]
|
37
|
-
s.rubygems_version = "1.8.24"
|
38
37
|
s.summary = "More efficient Mongoid document serialization for delayed_job."
|
39
38
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
s.add_development_dependency(%q<rspec>, [">= 0"])
|
50
|
-
s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
|
51
|
-
else
|
52
|
-
s.add_dependency(%q<delayed_job>, ["~> 3.0"])
|
53
|
-
s.add_dependency(%q<mongoid>, ["~> 3.0"])
|
54
|
-
s.add_dependency(%q<actionmailer>, [">= 0"])
|
55
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
56
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
57
|
-
s.add_dependency(%q<ruby-debug19>, [">= 0"])
|
58
|
-
end
|
59
|
-
else
|
60
|
-
s.add_dependency(%q<delayed_job>, ["~> 3.0"])
|
61
|
-
s.add_dependency(%q<mongoid>, ["~> 3.0"])
|
62
|
-
s.add_dependency(%q<actionmailer>, [">= 0"])
|
63
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
64
|
-
s.add_dependency(%q<rake >, ["~> 10.0"])
|
65
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
66
|
-
s.add_dependency(%q<ruby-debug19>, [">= 0"])
|
67
|
-
end
|
39
|
+
s.specification_version = 3
|
40
|
+
s.add_runtime_dependency(%q<delayed_job>, ["~> 3.0"])
|
41
|
+
s.add_runtime_dependency(%q<delayed_job_mongoid>, ["~> 2.0"])
|
42
|
+
s.add_runtime_dependency(%q<mongoid>, ["~> 3.0"])
|
43
|
+
s.add_development_dependency(%q<actionmailer>, [">= 0"])
|
44
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
45
|
+
s.add_development_dependency(%q<rake>, ["~> 10.0"])
|
46
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
47
|
+
s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
|
68
48
|
end
|
69
49
|
|
@@ -1,5 +1,11 @@
|
|
1
1
|
module Delayed
|
2
2
|
module ShallowMongoid
|
3
|
+
|
4
|
+
module Errors
|
5
|
+
class DocumentNotFound < StandardError
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
3
9
|
def self.dump(arg)
|
4
10
|
return arg unless arg.is_a?(::Mongoid::Document) && arg.persisted?
|
5
11
|
return arg if arg._updates.any? && !Delayed::Worker.delay_jobs
|
@@ -9,16 +15,22 @@ module Delayed
|
|
9
15
|
ShallowMongoid::DocumentStub.new(arg.class, arg._id.to_s)
|
10
16
|
end
|
11
17
|
end
|
12
|
-
|
18
|
+
|
13
19
|
def self.load(arg)
|
14
20
|
return arg unless arg.is_a?(ShallowMongoid::DocumentStub)
|
15
|
-
|
21
|
+
begin
|
22
|
+
result = arg.klass.find(arg.id)
|
23
|
+
raise Delayed::ShallowMongoid::Errors::DocumentNotFound unless result
|
24
|
+
rescue Mongoid::Errors::DocumentNotFound
|
25
|
+
raise Delayed::ShallowMongoid::Errors::DocumentNotFound
|
26
|
+
end
|
16
27
|
(arg.selector || []).each do |message|
|
17
28
|
result = result.send(*message)
|
18
29
|
end
|
30
|
+
raise Delayed::ShallowMongoid::Errors::DocumentNotFound unless result
|
19
31
|
result
|
20
32
|
end
|
21
|
-
|
33
|
+
|
22
34
|
# The chain of relations allowing us to locate an embedded document.
|
23
35
|
# E.g., ['images', ['find', '4eef..678'], 'width']
|
24
36
|
def self.selector_from(doc)
|
@@ -1,13 +1,11 @@
|
|
1
1
|
module Delayed
|
2
|
-
class PerformableMailer
|
2
|
+
class PerformableMailer < PerformableMethod
|
3
3
|
def perform
|
4
|
-
|
5
|
-
|
6
|
-
delayed_arguments = *args.map{|a| ShallowMongoid.load(a) }
|
7
|
-
rescue Mongoid::Errors::DocumentNotFound
|
8
|
-
return true # do nothing if document has been removed
|
9
|
-
end
|
4
|
+
klass = ShallowMongoid.load(object)
|
5
|
+
delayed_arguments = *args.map{|a| ShallowMongoid.load(a) }
|
10
6
|
klass.send(method_name, *delayed_arguments).deliver
|
7
|
+
rescue Delayed::ShallowMongoid::Errors::DocumentNotFound
|
8
|
+
return true # do nothing if document has been removed
|
11
9
|
end
|
12
10
|
end
|
13
11
|
end
|
@@ -11,14 +11,11 @@ module Delayed
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def perform
|
14
|
-
|
15
|
-
|
16
|
-
return true unless klass
|
17
|
-
delayed_arguments = *args.map{|a| ShallowMongoid.load(a) }
|
18
|
-
rescue Mongoid::Errors::DocumentNotFound
|
19
|
-
return true # do nothing if document has been removed
|
20
|
-
end
|
14
|
+
klass = ShallowMongoid.load(object)
|
15
|
+
delayed_arguments = *args.map{|a| ShallowMongoid.load(a) }
|
21
16
|
klass.send(method_name, *delayed_arguments)
|
17
|
+
rescue Delayed::ShallowMongoid::Errors::DocumentNotFound
|
18
|
+
return true # do nothing if document has been removed
|
22
19
|
end
|
23
20
|
|
24
21
|
def display_name
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'delayed_job'
|
2
2
|
require File.dirname(__FILE__) + '/delayed/shallow_mongoid'
|
3
|
+
require File.dirname(__FILE__) + '/delayed/shallow_mongoid/version'
|
3
4
|
require File.dirname(__FILE__) + '/delayed/shallow_mongoid/document_stub'
|
4
5
|
require File.dirname(__FILE__) + '/delayed/shallow_mongoid/performable_method'
|
5
6
|
require File.dirname(__FILE__) + '/delayed/shallow_mongoid/performable_mailer'
|
metadata
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delayed_job_shallow_mongoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Joey Aghion
|
9
|
+
- Daniel Doubrovkine
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
13
|
+
date: 2012-11-20 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: delayed_job
|
@@ -27,6 +28,22 @@ dependencies:
|
|
27
28
|
- - ~>
|
28
29
|
- !ruby/object:Gem::Version
|
29
30
|
version: '3.0'
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: delayed_job_mongoid
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ~>
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '2.0'
|
39
|
+
type: :runtime
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '2.0'
|
30
47
|
- !ruby/object:Gem::Dependency
|
31
48
|
name: mongoid
|
32
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -139,16 +156,13 @@ files:
|
|
139
156
|
- LICENSE.txt
|
140
157
|
- README.md
|
141
158
|
- Rakefile
|
142
|
-
- VERSION
|
143
159
|
- delayed_job_shallow_mongoid.gemspec
|
144
|
-
- lib/delayed/performable_mailer.rb
|
145
160
|
- lib/delayed/shallow_mongoid.rb
|
146
161
|
- lib/delayed/shallow_mongoid/document_stub.rb
|
147
162
|
- lib/delayed/shallow_mongoid/performable_mailer.rb
|
148
163
|
- lib/delayed/shallow_mongoid/performable_method.rb
|
164
|
+
- lib/delayed/shallow_mongoid/version.rb
|
149
165
|
- lib/delayed_job_shallow_mongoid.rb
|
150
|
-
- spec/delayed_job_shallow_mongoid_spec.rb
|
151
|
-
- spec/spec_helper.rb
|
152
166
|
homepage: http://github.com/joeyAghion/delayed_job_shallow_mongoid
|
153
167
|
licenses:
|
154
168
|
- MIT
|
@@ -164,13 +178,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
164
178
|
version: '0'
|
165
179
|
segments:
|
166
180
|
- 0
|
167
|
-
hash:
|
181
|
+
hash: 480325997688566083
|
168
182
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
183
|
none: false
|
170
184
|
requirements:
|
171
185
|
- - ! '>='
|
172
186
|
- !ruby/object:Gem::Version
|
173
187
|
version: '0'
|
188
|
+
segments:
|
189
|
+
- 0
|
190
|
+
hash: 480325997688566083
|
174
191
|
requirements: []
|
175
192
|
rubyforge_project:
|
176
193
|
rubygems_version: 1.8.24
|
data/VERSION
DELETED
@@ -1,176 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
class GrandchildModel
|
4
|
-
include ::Mongoid::Document
|
5
|
-
embedded_in :child_model, :inverse_of => :grandchild_models
|
6
|
-
end
|
7
|
-
class ChildModel
|
8
|
-
include ::Mongoid::Document
|
9
|
-
embedded_in :test_model, :inverse_of => :child_models
|
10
|
-
embeds_many :grandchild_models
|
11
|
-
end
|
12
|
-
class TestModel
|
13
|
-
include ::Mongoid::Document
|
14
|
-
field :title
|
15
|
-
embeds_many :child_models
|
16
|
-
end
|
17
|
-
|
18
|
-
describe Delayed::ShallowMongoid::DocumentStub do
|
19
|
-
it "should have a klass" do
|
20
|
-
@shallow = Delayed::ShallowMongoid::DocumentStub.new(TestModel, 111)
|
21
|
-
@shallow.klass.should == TestModel
|
22
|
-
end
|
23
|
-
it "should have an id" do
|
24
|
-
@shallow = Delayed::ShallowMongoid::DocumentStub.new(TestModel, 111)
|
25
|
-
@shallow.id.should == 111
|
26
|
-
end
|
27
|
-
it "should have an optional selector" do
|
28
|
-
@shallow = Delayed::ShallowMongoid::DocumentStub.new(TestModel, 111)
|
29
|
-
@shallow.selector.should == nil
|
30
|
-
end
|
31
|
-
it "can have an actual selector" do
|
32
|
-
@shallow = Delayed::ShallowMongoid::DocumentStub.new(TestModel, 111, [:a, :b])
|
33
|
-
@shallow.selector.should == [:a, :b]
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
describe ::Delayed::PerformableMethod do
|
38
|
-
context "with an unsaved document" do
|
39
|
-
it "should not transform an unsaved document" do
|
40
|
-
@model = TestModel.new
|
41
|
-
method = ::Delayed::PerformableMethod.new(@model, :to_s, [])
|
42
|
-
method.object.should_not be_a_kind_of(Delayed::ShallowMongoid::DocumentStub)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
context "with a saved document" do
|
47
|
-
before(:each) do
|
48
|
-
@model = TestModel.create #new(:_id => Moped::BSON::ObjectId.new)
|
49
|
-
end
|
50
|
-
|
51
|
-
context 'when saving job' do
|
52
|
-
context 'when jobs are run immediately' do
|
53
|
-
before { ::Delayed::Worker.delay_jobs = false }
|
54
|
-
after { ::Delayed::Worker.delay_jobs = true }
|
55
|
-
it "should not transform if there are pending changes and jobs are run immediately" do
|
56
|
-
@model.title = "updated"
|
57
|
-
method = ::Delayed::PerformableMethod.new(@model, :to_s, [])
|
58
|
-
method.object.should_not be_a_kind_of(Delayed::ShallowMongoid::DocumentStub)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
it "should transform object into shallow version" do
|
62
|
-
method = ::Delayed::PerformableMethod.new(@model, :to_s, [])
|
63
|
-
method.object.should be_a_kind_of(Delayed::ShallowMongoid::DocumentStub)
|
64
|
-
method.object.id.should == @model._id.to_s
|
65
|
-
end
|
66
|
-
it "should transform arg into shallow version" do
|
67
|
-
method = ::Delayed::PerformableMethod.new('test', :lines, [@model])
|
68
|
-
method.args.first.should be_a_kind_of(Delayed::ShallowMongoid::DocumentStub)
|
69
|
-
method.args.first.id.should == @model._id.to_s
|
70
|
-
end
|
71
|
-
context "with an embedded document" do
|
72
|
-
before(:each) do
|
73
|
-
@child = ChildModel.new(:_id => Moped::BSON::ObjectId.new)
|
74
|
-
@model.child_models.push @child
|
75
|
-
end
|
76
|
-
after(:each) do
|
77
|
-
@method.object.should be_a_kind_of(Delayed::ShallowMongoid::DocumentStub)
|
78
|
-
@method.object.id.should == @model.id.to_s
|
79
|
-
@method.object.klass.should == @model.class
|
80
|
-
end
|
81
|
-
it "should store the selector" do
|
82
|
-
@method = ::Delayed::PerformableMethod.new(@child, :to_s, [])
|
83
|
-
@method.object.selector.should == ['child_models', ['find', @child._id.to_s]]
|
84
|
-
end
|
85
|
-
it "should store the deeply nested selector" do
|
86
|
-
@grandchild = GrandchildModel.new(:_id => Moped::BSON::ObjectId.new)
|
87
|
-
@model.child_models.first.grandchild_models.push @grandchild
|
88
|
-
@method = ::Delayed::PerformableMethod.new(@grandchild, :to_s, [])
|
89
|
-
@method.object.selector.should == ['child_models', ['find', @child._id.to_s], 'grandchild_models', ['find', @grandchild._id.to_s]]
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
context 'when running job' do
|
95
|
-
it "should look up document" do
|
96
|
-
method = ::Delayed::PerformableMethod.new(@model, :to_s, [])
|
97
|
-
TestModel.should_receive(:find).with(@model._id.to_s).and_return(@model)
|
98
|
-
method.perform
|
99
|
-
end
|
100
|
-
it "should do nothing if document not found" do
|
101
|
-
method = ::Delayed::PerformableMethod.new(@model, :to_s, [])
|
102
|
-
error = ::Mongoid::Errors::DocumentNotFound.new(TestModel, nil, [ @model.id ])
|
103
|
-
TestModel.should_receive(:find).with(@model._id.to_s).and_raise(error)
|
104
|
-
method.perform.should be_true
|
105
|
-
end
|
106
|
-
it "should do nothing if document find returned nil" do
|
107
|
-
method = ::Delayed::PerformableMethod.new(@model, :to_s, [])
|
108
|
-
@model.destroy
|
109
|
-
TestModel.should_receive(:find).with(@model._id.to_s).and_return(nil)
|
110
|
-
method.perform.should be_true
|
111
|
-
end
|
112
|
-
it "should find embedded document" do
|
113
|
-
child = ChildModel.new(:_id => Moped::BSON::ObjectId.new)
|
114
|
-
@model.child_models.push child
|
115
|
-
method = ::Delayed::PerformableMethod.new(child, :to_s, [])
|
116
|
-
TestModel.should_receive(:find).with(@model._id.to_s).and_return(@model)
|
117
|
-
method.perform
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
context "display_name" do
|
122
|
-
it "should return underlying class when a stub is being used" do
|
123
|
-
method = ::Delayed::PerformableMethod.new(@model, :to_s, [])
|
124
|
-
method.display_name.should == "TestModel[#{@model._id}]#to_s"
|
125
|
-
end
|
126
|
-
it "should return usual name when no stub is involved" do
|
127
|
-
method = ::Delayed::PerformableMethod.new(:test, :to_s, [])
|
128
|
-
method.display_name.should == "Symbol#to_s"
|
129
|
-
end
|
130
|
-
it "should include selector when document is embedded" do
|
131
|
-
child = ChildModel.new(:_id => Moped::BSON::ObjectId.new)
|
132
|
-
@model.child_models.push child
|
133
|
-
method = ::Delayed::PerformableMethod.new(child, :to_s, [])
|
134
|
-
method.display_name.should == "TestModel[#{@model._id}].child_models.find(\"#{child._id}\")#to_s"
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
describe ::Delayed::PerformableMailer do
|
141
|
-
context "successful mailer" do
|
142
|
-
before do
|
143
|
-
@model = TestModel.create
|
144
|
-
@email = mock('email', :deliver => true)
|
145
|
-
@mailer_class = mock('MailerClass', :signup => @email)
|
146
|
-
@mailer = ::Delayed::PerformableMailer.new(@mailer_class, :signup, [@model])
|
147
|
-
end
|
148
|
-
it "should call the method and #deliver on the mailer" do
|
149
|
-
TestModel.should_receive(:find).with(@model._id.to_s).and_return(@model)
|
150
|
-
@mailer_class.should_receive(:signup).with(@model)
|
151
|
-
@email.should_receive(:deliver)
|
152
|
-
@mailer.perform
|
153
|
-
end
|
154
|
-
it "should do nothing if an argument document is not found" do
|
155
|
-
error = ::Mongoid::Errors::DocumentNotFound.new(TestModel, nil, [ @model._id ])
|
156
|
-
TestModel.should_receive(:find).with(@model._id.to_s).and_raise(error)
|
157
|
-
@mailer.perform.should be_true
|
158
|
-
end
|
159
|
-
end
|
160
|
-
context "failing mailer from bad record" do
|
161
|
-
before do
|
162
|
-
@model = TestModel.create
|
163
|
-
error = ::Mongoid::Errors::DocumentNotFound.new(TestModel, nil, [ @model._id ])
|
164
|
-
@email = mock('email')
|
165
|
-
@email.stub(:deliver).and_raise(error)
|
166
|
-
@mailer_class = mock('MailerClass', :signup => @email)
|
167
|
-
@mailer = ::Delayed::PerformableMailer.new(@mailer_class, :signup, [@model])
|
168
|
-
end
|
169
|
-
it "should fail if an exception comes up" do
|
170
|
-
TestModel.stub(:find).with(@model._id.to_s).and_return(@model)
|
171
|
-
-> {
|
172
|
-
@mailer.perform
|
173
|
-
}.should raise_error(::Mongoid::Errors::DocumentNotFound)
|
174
|
-
end
|
175
|
-
end
|
176
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler/setup'
|
3
|
-
|
4
|
-
require 'mail'
|
5
|
-
require 'action_mailer'
|
6
|
-
require 'mongoid'
|
7
|
-
require 'delayed_job_shallow_mongoid'
|
8
|
-
|
9
|
-
Mongoid.configure do |config|
|
10
|
-
config.connect_to('delayed_job_shallow_mongoid_test')
|
11
|
-
end
|
12
|
-
|
13
|
-
RSpec.configure do |config|
|
14
|
-
config.before(:each) do
|
15
|
-
Mongoid.purge!
|
16
|
-
Mongoid::IdentityMap.clear
|
17
|
-
end
|
18
|
-
config.after(:all) do
|
19
|
-
Mongoid.default_session.drop
|
20
|
-
end
|
21
|
-
end
|