resque_mailer 2.0.3 → 2.1.0
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 +9 -1
- data/LICENSE +1 -1
- data/README.md +3 -5
- data/lib/resque_mailer.rb +11 -3
- data/lib/resque_mailer/version.rb +5 -0
- metadata +23 -128
- data/.document +0 -3
- data/Gemfile +0 -17
- data/Gemfile.lock +0 -83
- data/Rakefile +0 -45
- data/VERSION +0 -1
- data/rails/init.rb +0 -1
- data/resque_mailer.gemspec +0 -76
- data/spec/resque_mailer_spec.rb +0 -110
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +0 -9
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
### 2.1.0 / 2012-02-17
|
2
|
+
|
3
|
+
* Message decoy acts more like a real message (to\_s)
|
4
|
+
* Removed jeweler as a dependency (managing gem directly via Bundler)
|
5
|
+
* Removed Resque dependency for compatibility with Resque forks
|
6
|
+
(mongo-resque, etc)
|
7
|
+
* Add support for non-Rails applications (Fabio Kreusch)
|
8
|
+
|
1
9
|
### 2.0.3 / 2012-02-17
|
2
10
|
|
3
11
|
* Added ability to override local queue name (example scenario: using
|
@@ -23,7 +31,7 @@
|
|
23
31
|
|
24
32
|
### 1.0.1 / 2010-12-21
|
25
33
|
|
26
|
-
* Respect ActionMailer::Base.
|
34
|
+
* Respect ActionMailer::Base.perform\_deliveries
|
27
35
|
|
28
36
|
### v1.0.0 / 2010-07-28
|
29
37
|
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -27,8 +27,8 @@ method variant:
|
|
27
27
|
|
28
28
|
MyMailer.subject_email(params).deliver!
|
29
29
|
|
30
|
-
Oh, by the way. Don't forget that your async mailer jobs will be processed by
|
31
|
-
a separate worker
|
30
|
+
Oh, by the way. Don't forget that **your async mailer jobs will be processed by
|
31
|
+
a separate worker**. This means that you should resist the temptation to pass
|
32
32
|
database-backed objects as parameters in your mailer and instead pass record
|
33
33
|
identifiers. Then, in your delivery method, you can look up the record from
|
34
34
|
the id and use it as needed.
|
@@ -92,6 +92,4 @@ configure the environments that should be excluded like so:
|
|
92
92
|
|
93
93
|
## Credits
|
94
94
|
|
95
|
-
|
96
|
-
(http://github.com/andersondias/delayed_job_mailer) by Anderson Dias. Enhanced
|
97
|
-
and modified to work with Resque by Nick Plante.
|
95
|
+
Developed by Nick Plante with help from a number of [contributors](https://github.com/zapnap/resque_mailer/contributors).
|
data/lib/resque_mailer.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
require 'resque_mailer/version'
|
2
|
+
|
1
3
|
module Resque
|
2
4
|
module Mailer
|
3
5
|
class << self
|
4
|
-
attr_accessor :default_queue_name, :default_queue_target
|
6
|
+
attr_accessor :default_queue_name, :default_queue_target, :current_env
|
5
7
|
attr_reader :excluded_environments
|
6
8
|
|
7
9
|
def excluded_environments=(envs)
|
@@ -19,7 +21,11 @@ module Resque
|
|
19
21
|
|
20
22
|
module ClassMethods
|
21
23
|
def current_env
|
22
|
-
|
24
|
+
if defined?(Rails)
|
25
|
+
::Resque::Mailer.current_env || ::Rails.env
|
26
|
+
else
|
27
|
+
::Resque::Mailer.current_env
|
28
|
+
end
|
23
29
|
end
|
24
30
|
|
25
31
|
def method_missing(method_name, *args)
|
@@ -53,7 +59,7 @@ module Resque
|
|
53
59
|
end
|
54
60
|
|
55
61
|
def excluded_environment?(name)
|
56
|
-
::Resque::Mailer.excluded_environments && ::Resque::Mailer.excluded_environments.include?(name.to_sym)
|
62
|
+
::Resque::Mailer.excluded_environments && ::Resque::Mailer.excluded_environments.include?(name.try(:to_sym))
|
57
63
|
end
|
58
64
|
|
59
65
|
def deliver?
|
@@ -62,6 +68,8 @@ module Resque
|
|
62
68
|
end
|
63
69
|
|
64
70
|
class MessageDecoy
|
71
|
+
delegate :to_s, :to => :actual_message
|
72
|
+
|
65
73
|
def initialize(mailer_class, method_name, *args)
|
66
74
|
@mailer_class = mailer_class
|
67
75
|
@method_name = method_name
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque_mailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 2.0.3
|
10
|
+
version: 2.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Nick Plante
|
@@ -15,58 +15,40 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-06-10 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
22
22
|
none: false
|
23
23
|
requirements:
|
24
|
-
- -
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
hash: 25
|
27
|
-
segments:
|
28
|
-
- 1
|
29
|
-
- 2
|
30
|
-
- 3
|
31
|
-
version: 1.2.3
|
32
|
-
requirement: *id001
|
33
|
-
prerelease: false
|
34
|
-
name: resque
|
35
|
-
type: :runtime
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
38
|
-
none: false
|
39
|
-
requirements:
|
40
|
-
- - ">="
|
24
|
+
- - ~>
|
41
25
|
- !ruby/object:Gem::Version
|
42
26
|
hash: 7
|
43
27
|
segments:
|
44
28
|
- 3
|
45
29
|
- 0
|
46
|
-
|
47
|
-
|
48
|
-
requirement: *id002
|
30
|
+
version: "3.0"
|
31
|
+
requirement: *id001
|
49
32
|
prerelease: false
|
50
33
|
name: actionmailer
|
51
34
|
type: :runtime
|
52
35
|
- !ruby/object:Gem::Dependency
|
53
|
-
version_requirements: &
|
36
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
54
37
|
none: false
|
55
38
|
requirements:
|
56
|
-
- -
|
39
|
+
- - ~>
|
57
40
|
- !ruby/object:Gem::Version
|
58
|
-
hash:
|
41
|
+
hash: 15
|
59
42
|
segments:
|
60
43
|
- 2
|
61
44
|
- 6
|
62
|
-
|
63
|
-
|
64
|
-
requirement: *id003
|
45
|
+
version: "2.6"
|
46
|
+
requirement: *id002
|
65
47
|
prerelease: false
|
66
48
|
name: rspec
|
67
49
|
type: :development
|
68
50
|
- !ruby/object:Gem::Dependency
|
69
|
-
version_requirements: &
|
51
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
70
52
|
none: false
|
71
53
|
requirements:
|
72
54
|
- - ">="
|
@@ -77,114 +59,27 @@ dependencies:
|
|
77
59
|
- 6
|
78
60
|
- 0
|
79
61
|
version: 0.6.0
|
80
|
-
requirement: *
|
62
|
+
requirement: *id003
|
81
63
|
prerelease: false
|
82
64
|
name: yard
|
83
65
|
type: :development
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
requirements:
|
88
|
-
- - ~>
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
hash: 23
|
91
|
-
segments:
|
92
|
-
- 1
|
93
|
-
- 0
|
94
|
-
- 0
|
95
|
-
version: 1.0.0
|
96
|
-
requirement: *id005
|
97
|
-
prerelease: false
|
98
|
-
name: bundler
|
99
|
-
type: :development
|
100
|
-
- !ruby/object:Gem::Dependency
|
101
|
-
version_requirements: &id006 !ruby/object:Gem::Requirement
|
102
|
-
none: false
|
103
|
-
requirements:
|
104
|
-
- - ~>
|
105
|
-
- !ruby/object:Gem::Version
|
106
|
-
hash: 11
|
107
|
-
segments:
|
108
|
-
- 1
|
109
|
-
- 6
|
110
|
-
- 2
|
111
|
-
version: 1.6.2
|
112
|
-
requirement: *id006
|
113
|
-
prerelease: false
|
114
|
-
name: jeweler
|
115
|
-
type: :development
|
116
|
-
- !ruby/object:Gem::Dependency
|
117
|
-
version_requirements: &id007 !ruby/object:Gem::Requirement
|
118
|
-
none: false
|
119
|
-
requirements:
|
120
|
-
- - ">="
|
121
|
-
- !ruby/object:Gem::Version
|
122
|
-
hash: 23
|
123
|
-
segments:
|
124
|
-
- 2
|
125
|
-
- 6
|
126
|
-
- 0
|
127
|
-
version: 2.6.0
|
128
|
-
requirement: *id007
|
129
|
-
prerelease: false
|
130
|
-
name: rspec
|
131
|
-
type: :development
|
132
|
-
- !ruby/object:Gem::Dependency
|
133
|
-
version_requirements: &id008 !ruby/object:Gem::Requirement
|
134
|
-
none: false
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
hash: 25
|
139
|
-
segments:
|
140
|
-
- 1
|
141
|
-
- 2
|
142
|
-
- 3
|
143
|
-
version: 1.2.3
|
144
|
-
requirement: *id008
|
145
|
-
prerelease: false
|
146
|
-
name: resque
|
147
|
-
type: :development
|
148
|
-
- !ruby/object:Gem::Dependency
|
149
|
-
version_requirements: &id009 !ruby/object:Gem::Requirement
|
150
|
-
none: false
|
151
|
-
requirements:
|
152
|
-
- - ">="
|
153
|
-
- !ruby/object:Gem::Version
|
154
|
-
hash: 7
|
155
|
-
segments:
|
156
|
-
- 3
|
157
|
-
- 0
|
158
|
-
- 0
|
159
|
-
version: 3.0.0
|
160
|
-
requirement: *id009
|
161
|
-
prerelease: false
|
162
|
-
name: actionmailer
|
163
|
-
type: :development
|
164
|
-
description: Rails plugin for sending asynchronous email with ActionMailer and Resque
|
165
|
-
email: nap@zerosum.org
|
66
|
+
description: Rails plugin for sending asynchronous email with ActionMailer and Resque.
|
67
|
+
email:
|
68
|
+
- nap@zerosum.org
|
166
69
|
executables: []
|
167
70
|
|
168
71
|
extensions: []
|
169
72
|
|
170
73
|
extra_rdoc_files:
|
171
74
|
- LICENSE
|
172
|
-
- README.md
|
173
|
-
files:
|
174
|
-
- .document
|
175
75
|
- CHANGELOG.md
|
176
|
-
- Gemfile
|
177
|
-
- Gemfile.lock
|
178
|
-
- LICENSE
|
179
76
|
- README.md
|
180
|
-
|
181
|
-
-
|
77
|
+
files:
|
78
|
+
- lib/resque_mailer/version.rb
|
182
79
|
- lib/resque_mailer.rb
|
183
|
-
-
|
184
|
-
-
|
185
|
-
-
|
186
|
-
- spec/spec.opts
|
187
|
-
- spec/spec_helper.rb
|
80
|
+
- README.md
|
81
|
+
- LICENSE
|
82
|
+
- CHANGELOG.md
|
188
83
|
homepage: http://github.com/zapnap/resque_mailer
|
189
84
|
licenses: []
|
190
85
|
|
@@ -217,6 +112,6 @@ rubyforge_project:
|
|
217
112
|
rubygems_version: 1.8.9
|
218
113
|
signing_key:
|
219
114
|
specification_version: 3
|
220
|
-
summary: Rails plugin for sending asynchronous email with ActionMailer and Resque
|
115
|
+
summary: Rails plugin for sending asynchronous email with ActionMailer and Resque.
|
221
116
|
test_files: []
|
222
117
|
|
data/.document
DELETED
data/Gemfile
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
source 'http://rubygems.org'
|
2
|
-
|
3
|
-
# Add dependencies required to use your gem here.
|
4
|
-
# Example:
|
5
|
-
# gem 'activesupport', '>= 2.3.5'
|
6
|
-
|
7
|
-
gem 'resque', '>= 1.2.3'
|
8
|
-
gem 'actionmailer', '>= 3.0.0'
|
9
|
-
|
10
|
-
# Add dependencies to develop your gem here.
|
11
|
-
# Include everything needed to run rake, tests, features, etc.
|
12
|
-
group :development do
|
13
|
-
gem 'rspec', '>= 2.6.0'
|
14
|
-
gem 'yard', '>= 0.6.0'
|
15
|
-
gem 'bundler', '~> 1.0.0'
|
16
|
-
gem 'jeweler', '~> 1.6.2'
|
17
|
-
end
|
data/Gemfile.lock
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
abstract (1.0.0)
|
5
|
-
actionmailer (3.0.9)
|
6
|
-
actionpack (= 3.0.9)
|
7
|
-
mail (~> 2.2.19)
|
8
|
-
actionpack (3.0.9)
|
9
|
-
activemodel (= 3.0.9)
|
10
|
-
activesupport (= 3.0.9)
|
11
|
-
builder (~> 2.1.2)
|
12
|
-
erubis (~> 2.6.6)
|
13
|
-
i18n (~> 0.5.0)
|
14
|
-
rack (~> 1.2.1)
|
15
|
-
rack-mount (~> 0.6.14)
|
16
|
-
rack-test (~> 0.5.7)
|
17
|
-
tzinfo (~> 0.3.23)
|
18
|
-
activemodel (3.0.9)
|
19
|
-
activesupport (= 3.0.9)
|
20
|
-
builder (~> 2.1.2)
|
21
|
-
i18n (~> 0.5.0)
|
22
|
-
activesupport (3.0.9)
|
23
|
-
builder (2.1.2)
|
24
|
-
diff-lcs (1.1.2)
|
25
|
-
erubis (2.6.6)
|
26
|
-
abstract (>= 1.0.0)
|
27
|
-
git (1.2.5)
|
28
|
-
i18n (0.5.0)
|
29
|
-
jeweler (1.6.2)
|
30
|
-
bundler (~> 1.0)
|
31
|
-
git (>= 1.2.5)
|
32
|
-
rake
|
33
|
-
json (1.5.3)
|
34
|
-
mail (2.2.19)
|
35
|
-
activesupport (>= 2.3.6)
|
36
|
-
i18n (>= 0.4.0)
|
37
|
-
mime-types (~> 1.16)
|
38
|
-
treetop (~> 1.4.8)
|
39
|
-
mime-types (1.16)
|
40
|
-
polyglot (0.3.1)
|
41
|
-
rack (1.2.3)
|
42
|
-
rack-mount (0.6.14)
|
43
|
-
rack (>= 1.0.0)
|
44
|
-
rack-test (0.5.7)
|
45
|
-
rack (>= 1.0)
|
46
|
-
rake (0.9.2)
|
47
|
-
redis (2.2.1)
|
48
|
-
redis-namespace (1.0.3)
|
49
|
-
redis (< 3.0.0)
|
50
|
-
resque (1.17.1)
|
51
|
-
json (>= 1.4.6, < 1.6)
|
52
|
-
redis-namespace (~> 1.0.2)
|
53
|
-
sinatra (>= 0.9.2)
|
54
|
-
vegas (~> 0.1.2)
|
55
|
-
rspec (2.6.0)
|
56
|
-
rspec-core (~> 2.6.0)
|
57
|
-
rspec-expectations (~> 2.6.0)
|
58
|
-
rspec-mocks (~> 2.6.0)
|
59
|
-
rspec-core (2.6.4)
|
60
|
-
rspec-expectations (2.6.0)
|
61
|
-
diff-lcs (~> 1.1.2)
|
62
|
-
rspec-mocks (2.6.0)
|
63
|
-
sinatra (1.2.6)
|
64
|
-
rack (~> 1.1)
|
65
|
-
tilt (>= 1.2.2, < 2.0)
|
66
|
-
tilt (1.3.2)
|
67
|
-
treetop (1.4.9)
|
68
|
-
polyglot (>= 0.3.1)
|
69
|
-
tzinfo (0.3.28)
|
70
|
-
vegas (0.1.8)
|
71
|
-
rack (>= 1.0.0)
|
72
|
-
yard (0.7.2)
|
73
|
-
|
74
|
-
PLATFORMS
|
75
|
-
ruby
|
76
|
-
|
77
|
-
DEPENDENCIES
|
78
|
-
actionmailer (>= 3.0.0)
|
79
|
-
bundler (~> 1.0.0)
|
80
|
-
jeweler (~> 1.6.2)
|
81
|
-
resque (>= 1.2.3)
|
82
|
-
rspec (>= 2.6.0)
|
83
|
-
yard (>= 0.6.0)
|
data/Rakefile
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'bundler'
|
5
|
-
|
6
|
-
begin
|
7
|
-
Bundler.setup(:default, :development)
|
8
|
-
rescue Bundler::BundlerError => e
|
9
|
-
$stderr.puts e.message
|
10
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
11
|
-
exit e.status_code
|
12
|
-
end
|
13
|
-
|
14
|
-
require 'rake'
|
15
|
-
|
16
|
-
begin
|
17
|
-
require 'jeweler'
|
18
|
-
Jeweler::Tasks.new do |gem|
|
19
|
-
gem.name = "resque_mailer"
|
20
|
-
gem.summary = %Q{Rails plugin for sending asynchronous email with ActionMailer and Resque}
|
21
|
-
gem.description = %Q{Rails plugin for sending asynchronous email with ActionMailer and Resque}
|
22
|
-
gem.email = "nap@zerosum.org"
|
23
|
-
gem.homepage = "http://github.com/zapnap/resque_mailer"
|
24
|
-
gem.authors = ["Nick Plante"]
|
25
|
-
gem.add_development_dependency "rspec", ">= 2.6.0"
|
26
|
-
gem.add_development_dependency "resque", ">= 1.2.3"
|
27
|
-
gem.add_development_dependency "actionmailer", ">= 3.0.0"
|
28
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
29
|
-
end
|
30
|
-
Jeweler::RubygemsDotOrgTasks.new
|
31
|
-
rescue LoadError
|
32
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
33
|
-
end
|
34
|
-
|
35
|
-
require 'rspec/core'
|
36
|
-
require 'rspec/core/rake_task'
|
37
|
-
|
38
|
-
RSpec::Core::RakeTask.new(:spec) do |spec|
|
39
|
-
spec.pattern = ["spec/resque_mailer_spec.rb"]
|
40
|
-
end
|
41
|
-
|
42
|
-
task :default => :spec
|
43
|
-
|
44
|
-
require 'yard'
|
45
|
-
YARD::Rake::YardocTask.new
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.0.3
|
data/rails/init.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__), '../lib', 'resque_mailer'))
|
data/resque_mailer.gemspec
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{resque_mailer}
|
8
|
-
s.version = "2.0.3"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = [%q{Nick Plante}]
|
12
|
-
s.date = %q{2012-02-17}
|
13
|
-
s.description = %q{Rails plugin for sending asynchronous email with ActionMailer and Resque}
|
14
|
-
s.email = %q{nap@zerosum.org}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.md"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
"CHANGELOG.md",
|
22
|
-
"Gemfile",
|
23
|
-
"Gemfile.lock",
|
24
|
-
"LICENSE",
|
25
|
-
"README.md",
|
26
|
-
"Rakefile",
|
27
|
-
"VERSION",
|
28
|
-
"lib/resque_mailer.rb",
|
29
|
-
"rails/init.rb",
|
30
|
-
"resque_mailer.gemspec",
|
31
|
-
"spec/resque_mailer_spec.rb",
|
32
|
-
"spec/spec.opts",
|
33
|
-
"spec/spec_helper.rb"
|
34
|
-
]
|
35
|
-
s.homepage = %q{http://github.com/zapnap/resque_mailer}
|
36
|
-
s.require_paths = [%q{lib}]
|
37
|
-
s.rubygems_version = %q{1.8.9}
|
38
|
-
s.summary = %q{Rails plugin for sending asynchronous email with ActionMailer and Resque}
|
39
|
-
|
40
|
-
if s.respond_to? :specification_version then
|
41
|
-
s.specification_version = 3
|
42
|
-
|
43
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
44
|
-
s.add_runtime_dependency(%q<resque>, [">= 1.2.3"])
|
45
|
-
s.add_runtime_dependency(%q<actionmailer>, [">= 3.0.0"])
|
46
|
-
s.add_development_dependency(%q<rspec>, [">= 2.6.0"])
|
47
|
-
s.add_development_dependency(%q<yard>, [">= 0.6.0"])
|
48
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
49
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.6.2"])
|
50
|
-
s.add_development_dependency(%q<rspec>, [">= 2.6.0"])
|
51
|
-
s.add_development_dependency(%q<resque>, [">= 1.2.3"])
|
52
|
-
s.add_development_dependency(%q<actionmailer>, [">= 3.0.0"])
|
53
|
-
else
|
54
|
-
s.add_dependency(%q<resque>, [">= 1.2.3"])
|
55
|
-
s.add_dependency(%q<actionmailer>, [">= 3.0.0"])
|
56
|
-
s.add_dependency(%q<rspec>, [">= 2.6.0"])
|
57
|
-
s.add_dependency(%q<yard>, [">= 0.6.0"])
|
58
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
59
|
-
s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
|
60
|
-
s.add_dependency(%q<rspec>, [">= 2.6.0"])
|
61
|
-
s.add_dependency(%q<resque>, [">= 1.2.3"])
|
62
|
-
s.add_dependency(%q<actionmailer>, [">= 3.0.0"])
|
63
|
-
end
|
64
|
-
else
|
65
|
-
s.add_dependency(%q<resque>, [">= 1.2.3"])
|
66
|
-
s.add_dependency(%q<actionmailer>, [">= 3.0.0"])
|
67
|
-
s.add_dependency(%q<rspec>, [">= 2.6.0"])
|
68
|
-
s.add_dependency(%q<yard>, [">= 0.6.0"])
|
69
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
70
|
-
s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
|
71
|
-
s.add_dependency(%q<rspec>, [">= 2.6.0"])
|
72
|
-
s.add_dependency(%q<resque>, [">= 1.2.3"])
|
73
|
-
s.add_dependency(%q<actionmailer>, [">= 3.0.0"])
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
data/spec/resque_mailer_spec.rb
DELETED
@@ -1,110 +0,0 @@
|
|
1
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
|
2
|
-
|
3
|
-
class FakeResque
|
4
|
-
def self.enqueue(*args); end
|
5
|
-
end
|
6
|
-
|
7
|
-
class Rails3Mailer < ActionMailer::Base
|
8
|
-
include Resque::Mailer
|
9
|
-
default :from => "from@example.org", :subject => "Subject"
|
10
|
-
MAIL_PARAMS = { :to => "crafty@example.org" }
|
11
|
-
|
12
|
-
def test_mail(*params)
|
13
|
-
Resque::Mailer.success!
|
14
|
-
mail(*params)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
class PriorityMailer < Rails3Mailer
|
19
|
-
self.queue = 'priority_mailer'
|
20
|
-
end
|
21
|
-
|
22
|
-
describe Resque::Mailer do
|
23
|
-
let(:resque) { FakeResque }
|
24
|
-
|
25
|
-
before do
|
26
|
-
Resque::Mailer.default_queue_target = resque
|
27
|
-
Resque::Mailer.stub(:success!)
|
28
|
-
Rails3Mailer.stub(:current_env => :test)
|
29
|
-
end
|
30
|
-
|
31
|
-
describe "resque" do
|
32
|
-
it "allows overriding of the default queue target (for testing)" do
|
33
|
-
Resque::Mailer.default_queue_target = FakeResque
|
34
|
-
Rails3Mailer.resque.should == FakeResque
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe "queue" do
|
39
|
-
it "defaults to the 'mailer' queue" do
|
40
|
-
Rails3Mailer.queue.should == "mailer"
|
41
|
-
end
|
42
|
-
|
43
|
-
it "allows overriding of the default queue name" do
|
44
|
-
Resque::Mailer.default_queue_name = "postal"
|
45
|
-
Rails3Mailer.queue.should == "postal"
|
46
|
-
end
|
47
|
-
|
48
|
-
it "allows overriding of the local queue name" do
|
49
|
-
PriorityMailer.queue.should == "priority_mailer"
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe '#deliver' do
|
54
|
-
before(:all) do
|
55
|
-
@delivery = lambda {
|
56
|
-
Rails3Mailer.test_mail(Rails3Mailer::MAIL_PARAMS).deliver
|
57
|
-
}
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'should not deliver the email synchronously' do
|
61
|
-
lambda { @delivery.call }.should_not change(ActionMailer::Base.deliveries, :size)
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'should place the deliver action on the Resque "mailer" queue' do
|
65
|
-
resque.should_receive(:enqueue).with(Rails3Mailer, :test_mail, Rails3Mailer::MAIL_PARAMS)
|
66
|
-
@delivery.call
|
67
|
-
end
|
68
|
-
|
69
|
-
context "when current env is excluded" do
|
70
|
-
it 'should not deliver through Resque for excluded environments' do
|
71
|
-
Resque::Mailer.stub(:excluded_environments => [:custom])
|
72
|
-
Rails3Mailer.should_receive(:current_env).and_return(:custom)
|
73
|
-
resque.should_not_receive(:enqueue)
|
74
|
-
@delivery.call
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
it 'should not invoke the method body more than once' do
|
79
|
-
Resque::Mailer.should_not_receive(:success!)
|
80
|
-
Rails3Mailer.test_mail(Rails3Mailer::MAIL_PARAMS).deliver
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
describe '#deliver!' do
|
85
|
-
it 'should deliver the email synchronously' do
|
86
|
-
lambda { Rails3Mailer.test_mail(Rails3Mailer::MAIL_PARAMS).deliver! }.should change(ActionMailer::Base.deliveries, :size).by(1)
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
describe 'perform' do
|
91
|
-
it 'should perform a queued mailer job' do
|
92
|
-
lambda {
|
93
|
-
Rails3Mailer.perform(:test_mail, Rails3Mailer::MAIL_PARAMS)
|
94
|
-
}.should change(ActionMailer::Base.deliveries, :size).by(1)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
describe 'original mail methods' do
|
99
|
-
it 'should be preserved' do
|
100
|
-
Rails3Mailer.test_mail(Rails3Mailer::MAIL_PARAMS).subject.should == 'Subject'
|
101
|
-
Rails3Mailer.test_mail(Rails3Mailer::MAIL_PARAMS).from.should include('from@example.org')
|
102
|
-
Rails3Mailer.test_mail(Rails3Mailer::MAIL_PARAMS).to.should include('crafty@example.org')
|
103
|
-
end
|
104
|
-
|
105
|
-
it 'should require execution of the method body prior to queueing' do
|
106
|
-
Resque::Mailer.should_receive(:success!).once
|
107
|
-
Rails3Mailer.test_mail(Rails3Mailer::MAIL_PARAMS).subject
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
data/spec/spec.opts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
data/spec/spec_helper.rb
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
-
|
4
|
-
require 'action_mailer'
|
5
|
-
require 'resque_mailer'
|
6
|
-
require 'rspec/autorun'
|
7
|
-
|
8
|
-
Resque::Mailer.excluded_environments = []
|
9
|
-
ActionMailer::Base.delivery_method = :test
|