redis_cache_mailer_delivery 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +5 -0
- data/README.md +4 -1
- data/Rakefile +1 -0
- data/lib/redis_cache_mailer_delivery/mail/cache_delivery.rb +1 -9
- data/lib/redis_cache_mailer_delivery/version.rb +1 -1
- data/redis_cache_mailer_delivery.gemspec +1 -0
- data/spec/redis_cache_mailer_delivery/deliveries_spec.rb +0 -4
- data/spec/redis_cache_mailer_delivery/mail/cache_delivery_spec.rb +18 -0
- data/spec/spec_helper.rb +4 -0
- data/tasks/spec.rb +17 -0
- metadata +22 -4
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# RedisCacheMailerDelivery
|
2
2
|
|
3
|
+
[![Build Status](https://secure.travis-ci.org/ywen/redis_cache_mailer_delivery.png)](http://travis-ci.org/ywen/redis_cache_mailer_delivery)
|
4
|
+
|
5
|
+
|
3
6
|
This gem is inspired by https://github.com/p0deje/action_mailer_cache_delivery.
|
4
7
|
|
5
8
|
If you are using Resque for sending mails asynchronously, and you want to test the mail sending asynchronously in your integration tests, then you can use this gem for just that.
|
@@ -40,7 +43,7 @@ You don't have to define the redis_key_name, the default is
|
|
40
43
|
All the mails being delivered will be written into the redis storage. You can use
|
41
44
|
|
42
45
|
```ruby
|
43
|
-
|
46
|
+
RedisCacheMailerDelivery::Deliveries.all
|
44
47
|
```
|
45
48
|
|
46
49
|
to access all the mails
|
data/Rakefile
CHANGED
@@ -1,16 +1,8 @@
|
|
1
1
|
module Mail
|
2
2
|
#
|
3
|
-
# Performs deliveries to
|
3
|
+
# Performs deliveries to redis storage, so mails can accessed from
|
4
4
|
# other processes.
|
5
5
|
#
|
6
|
-
# Default location of files is:
|
7
|
-
# - "tmp/cache/action_mailer_cache_deliveries.cache" if you use Rails
|
8
|
-
# - "/tmp/cache/action_mailer_cache_deliveries.cache" if you don't use Rails
|
9
|
-
#
|
10
|
-
# However, you can overwrite location in configuration:
|
11
|
-
#
|
12
|
-
# @example
|
13
|
-
# config.action_mailer.cache_settings = { location: "custom/path" }
|
14
6
|
#
|
15
7
|
class CacheDelivery
|
16
8
|
|
@@ -2,10 +2,6 @@ require File.expand_path(File.join(File.dirname(__FILE__), "..", "spec_helper"))
|
|
2
2
|
|
3
3
|
module RedisCacheMailerDelivery
|
4
4
|
describe Deliveries do
|
5
|
-
before(:each) do
|
6
|
-
RedisCacheMailerDelivery.install
|
7
|
-
Redis.current = Redis.new(:host => '127.0.0.1', :port => 6379)
|
8
|
-
end
|
9
5
|
|
10
6
|
describe ".all" do
|
11
7
|
let(:object) { Mail::Message.new}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper"))
|
2
|
+
|
3
|
+
module Mail
|
4
|
+
describe CacheDelivery do
|
5
|
+
subject {described_class.new :redis_key_name => "a-name"}
|
6
|
+
describe "#deliver!" do
|
7
|
+
let(:object) {Mail::Message.new}
|
8
|
+
|
9
|
+
after(:each) do
|
10
|
+
Redis.current.del "a-name"
|
11
|
+
end
|
12
|
+
it "puts a object into the redis store" do
|
13
|
+
subject.deliver!(object)
|
14
|
+
Redis::List.new("a-name", :marshal => true).values[0].should eq(object)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -17,6 +17,10 @@ RSpec.configure do |config|
|
|
17
17
|
# out = ENV['CC_BUILD_ARTIFACTS'] || "#{Rails.root}"
|
18
18
|
# config.output_stream = File.open("#{out}/UnitTests/index.html", "w") if config.formatter_class.name =~ /HtmlFormatter/
|
19
19
|
|
20
|
+
config.before(:each) do
|
21
|
+
RedisCacheMailerDelivery.install
|
22
|
+
Redis.current = Redis.new(:host => '127.0.0.1', :port => 6379)
|
23
|
+
end
|
20
24
|
|
21
25
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
22
26
|
# examples within a transaction, comment the following line or assign false
|
data/tasks/spec.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
begin
|
2
|
+
require 'rspec/core'
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
|
5
|
+
spec_prereq = :noop
|
6
|
+
task :noop do
|
7
|
+
end
|
8
|
+
|
9
|
+
desc "Run all specs in spec directory (excluding plugin specs)"
|
10
|
+
RSpec::Core::RakeTask.new(:spec => spec_prereq) do |t|
|
11
|
+
t.rspec_opts = ["--format", "documentation"]
|
12
|
+
t.pattern = "spec/**/*_spec.rb"
|
13
|
+
end
|
14
|
+
|
15
|
+
rescue LoadError => e
|
16
|
+
p e
|
17
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis_cache_mailer_delivery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Yi Wen
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-03-
|
18
|
+
date: 2012-03-23 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: redis
|
@@ -115,6 +115,20 @@ dependencies:
|
|
115
115
|
version: "0"
|
116
116
|
type: :development
|
117
117
|
version_requirements: *id007
|
118
|
+
- !ruby/object:Gem::Dependency
|
119
|
+
name: rake
|
120
|
+
prerelease: false
|
121
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
hash: 3
|
127
|
+
segments:
|
128
|
+
- 0
|
129
|
+
version: "0"
|
130
|
+
type: :development
|
131
|
+
version_requirements: *id008
|
118
132
|
description: Use Redis to store the Mail::Message when using in Rails
|
119
133
|
email:
|
120
134
|
- hayafirst@gmail.com
|
@@ -128,6 +142,7 @@ files:
|
|
128
142
|
- .gitignore
|
129
143
|
- .rspec
|
130
144
|
- .rvmrc
|
145
|
+
- .travis.yml
|
131
146
|
- Gemfile
|
132
147
|
- Guardfile
|
133
148
|
- LICENSE
|
@@ -140,9 +155,11 @@ files:
|
|
140
155
|
- lib/redis_cache_mailer_delivery/version.rb
|
141
156
|
- redis_cache_mailer_delivery.gemspec
|
142
157
|
- spec/redis_cache_mailer_delivery/deliveries_spec.rb
|
158
|
+
- spec/redis_cache_mailer_delivery/mail/cache_delivery_spec.rb
|
143
159
|
- spec/redis_cache_mailer_delivery_spec.rb
|
144
160
|
- spec/spec_helper.rb
|
145
161
|
- spec/support/faked_rails.rb
|
162
|
+
- tasks/spec.rb
|
146
163
|
homepage: https://github.com/ywen/redis_cache_mailer_delivery
|
147
164
|
licenses: []
|
148
165
|
|
@@ -178,6 +195,7 @@ specification_version: 3
|
|
178
195
|
summary: Use Redis to store the Mail::Message when using in Rails
|
179
196
|
test_files:
|
180
197
|
- spec/redis_cache_mailer_delivery/deliveries_spec.rb
|
198
|
+
- spec/redis_cache_mailer_delivery/mail/cache_delivery_spec.rb
|
181
199
|
- spec/redis_cache_mailer_delivery_spec.rb
|
182
200
|
- spec/spec_helper.rb
|
183
201
|
- spec/support/faked_rails.rb
|