devise-async 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +7 -0
- data/README.md +9 -22
- data/devise-async.gemspec +1 -1
- data/lib/devise/async.rb +0 -5
- data/lib/devise/async/backend/base.rb +3 -3
- data/lib/devise/async/backend/queue_classic.rb +2 -2
- data/lib/devise/async/backend/resque.rb +2 -2
- data/lib/devise/async/model.rb +5 -5
- data/lib/devise/async/version.rb +1 -1
- data/lib/devise/async/worker.rb +2 -2
- data/test/devise/async/backend/base_test.rb +3 -3
- data/test/devise/async/backend/delayed_job_test.rb +3 -3
- data/test/devise/async/backend/queue_classic_test.rb +4 -4
- data/test/devise/async/backend/resque_test.rb +4 -4
- data/test/devise/async/backend/sidekiq_test.rb +4 -4
- data/test/devise/async/model_test.rb +7 -7
- data/test/devise/async/worker_test.rb +8 -8
- data/test/devise/async_test.rb +0 -6
- data/test/support/helpers.rb +2 -2
- data/test/support/rails_app/config/initializers/devise.rb +1 -1
- metadata +5 -14
- data/lib/devise/async/proxy.rb +0 -20
- data/test/devise/async/proxy_test.rb +0 -13
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
## Unreleased
|
2
2
|
|
3
|
+
## 0.6.0
|
4
|
+
|
5
|
+
* Now compatible with Devise 2.2+ only
|
6
|
+
* Legacy `Devise::Async::Proxy` is now gone
|
7
|
+
* `Devise::Async.mailer=` is gone since there's no need for it anymore.
|
8
|
+
Use `Devise.mailer` directly.
|
9
|
+
|
3
10
|
## 0.5.1
|
4
11
|
|
5
12
|
* Lock dependency of 0.5 series on devise < 2.2
|
data/README.md
CHANGED
@@ -44,32 +44,14 @@ Devise::Async.backend = :resque
|
|
44
44
|
|
45
45
|
Tip: it defaults to Resque. You don't need to create the initializer if using it.
|
46
46
|
|
47
|
-
### Devise < 2.1.1
|
48
|
-
|
49
|
-
Set `Devise::Async::Proxy` as Devise's mailer in `config/initializers/devise.rb`:
|
50
|
-
|
51
|
-
```ruby
|
52
|
-
# Configure the class responsible to send e-mails.
|
53
|
-
config.mailer = "Devise::Async::Proxy"
|
54
|
-
```
|
55
|
-
|
56
|
-
WARNING 1: before devise 2.1.1 devise-async had issues with background jobs trying to run
|
57
|
-
before the record was committed to the DB if the creation was transactioned.
|
58
|
-
|
59
|
-
WARNING 2: I intend to deprecate support for devise < 2.1.1 before 1.0.0 and drop support
|
60
|
-
in the 1.0.0 release. Please consider upgrading your Devise version.
|
61
|
-
|
62
47
|
## Advanced Options
|
63
48
|
|
64
49
|
### Custom mailer class
|
65
50
|
|
66
|
-
|
67
|
-
you'll need to tell `Devise::Async` to proxy to that class.
|
51
|
+
Customize `Devise.mailer` at will and `devise-async` will honor it.
|
68
52
|
|
69
|
-
|
70
|
-
|
71
|
-
Devise::Async.mailer = "MyCustomMailer"
|
72
|
-
```
|
53
|
+
Upgrade note: if you're upgrading from any version < 0.6 and getting errors
|
54
|
+
trying to set `Devise::Async.mailer` just use `Devise.mailer` instead.
|
73
55
|
|
74
56
|
### Custom queue
|
75
57
|
|
@@ -90,7 +72,6 @@ similar do what `Devise` offers.
|
|
90
72
|
# config/initializers/devise_async.rb
|
91
73
|
Devise::Async.setup do |config|
|
92
74
|
config.backend = :resque
|
93
|
-
config.mailer = "MyCustomMailer"
|
94
75
|
config.queue = :my_custom_queue
|
95
76
|
end
|
96
77
|
```
|
@@ -103,6 +84,12 @@ might not be enqueued as you'd expect.
|
|
103
84
|
|
104
85
|
More details in this stackoverflow [thread](http://stackoverflow.com/questions/13406248/how-do-i-get-devise-async-working-with-cucumber/13465089#13465089).
|
105
86
|
|
87
|
+
## Devise < 2.2
|
88
|
+
|
89
|
+
Older versions of Devise are supported in the [devise_2_1](https://github.com/mhfs/devise-async/tree/devise_2_1) branch and in the 0.5 series of devise-async.
|
90
|
+
|
91
|
+
Please refer to that branch README for further info.
|
92
|
+
|
106
93
|
## Contributing
|
107
94
|
|
108
95
|
1. Fork it
|
data/devise-async.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = Devise::Async::VERSION
|
17
17
|
|
18
|
-
gem.add_dependency "devise", ">=
|
18
|
+
gem.add_dependency "devise", ">= 2.2"
|
19
19
|
|
20
20
|
gem.add_development_dependency "activerecord", "~> 3.2"
|
21
21
|
gem.add_development_dependency "actionpack", "~> 3.2"
|
data/lib/devise/async.rb
CHANGED
@@ -3,7 +3,6 @@ require "devise/async/version"
|
|
3
3
|
|
4
4
|
module Devise
|
5
5
|
module Async
|
6
|
-
autoload :Proxy, "devise/async/proxy"
|
7
6
|
autoload :Worker, "devise/async/worker"
|
8
7
|
autoload :Backend, "devise/async/backend"
|
9
8
|
autoload :Model, "devise/async/model"
|
@@ -20,10 +19,6 @@ module Devise
|
|
20
19
|
mattr_accessor :backend
|
21
20
|
@@backend = :resque
|
22
21
|
|
23
|
-
# Defines the mailer class to be used. Devise::Mailer by default.
|
24
|
-
mattr_accessor :mailer
|
25
|
-
@@mailer = "Devise::Mailer"
|
26
|
-
|
27
22
|
# Defines the queue in which the background job will be enqueued. Default is :mailer.
|
28
23
|
mattr_accessor :queue
|
29
24
|
@@queue = :mailer
|
@@ -10,15 +10,15 @@ module Devise
|
|
10
10
|
#
|
11
11
|
# It uses `orm_adapter` API to fetch the record in order to enforce
|
12
12
|
# compatibility among diferent ORMs.
|
13
|
-
def perform(method, resource_class, resource_id)
|
13
|
+
def perform(method, resource_class, resource_id, opts)
|
14
14
|
resource = resource_class.constantize.to_adapter.get!(resource_id)
|
15
|
-
mailer_class.send(method, resource).deliver
|
15
|
+
mailer_class.send(method, resource, opts).deliver
|
16
16
|
end
|
17
17
|
|
18
18
|
private
|
19
19
|
|
20
20
|
def mailer_class
|
21
|
-
@mailer_class ||= Devise
|
21
|
+
@mailer_class ||= Devise.mailer
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -11,8 +11,8 @@ module Devise
|
|
11
11
|
queue.enqueue(*args)
|
12
12
|
end
|
13
13
|
|
14
|
-
def self.perform(method, resource_class, resource_id)
|
15
|
-
new.perform(method, resource_class, resource_id)
|
14
|
+
def self.perform(method, resource_class, resource_id, opts)
|
15
|
+
new.perform(method, resource_class, resource_id, opts)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -9,8 +9,8 @@ module Devise
|
|
9
9
|
::Resque.enqueue(*args)
|
10
10
|
end
|
11
11
|
|
12
|
-
def self.perform(method, resource_class, resource_id)
|
13
|
-
new.perform(method, resource_class, resource_id)
|
12
|
+
def self.perform(method, resource_class, resource_id, opts)
|
13
|
+
new.perform(method, resource_class, resource_id, opts)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
data/lib/devise/async/model.rb
CHANGED
@@ -35,24 +35,24 @@ module Devise
|
|
35
35
|
# to capture all email notifications and enqueue it for background
|
36
36
|
# processing instead of sending it inline as devise does by
|
37
37
|
# default.
|
38
|
-
def send_devise_notification(notification)
|
38
|
+
def send_devise_notification(notification, opts = {})
|
39
39
|
# If the record is dirty we keep pending notifications to be enqueued
|
40
40
|
# by the callback and avoid before commit job processing.
|
41
41
|
if changed?
|
42
|
-
devise_pending_notifications << notification
|
42
|
+
devise_pending_notifications << [ notification, opts ]
|
43
43
|
# If the record isn't dirty (aka has already been saved) enqueue right away
|
44
44
|
# because the callback has already been triggered.
|
45
45
|
else
|
46
|
-
Devise::Async::Worker.enqueue(notification, self.class.name, self.id.to_s)
|
46
|
+
Devise::Async::Worker.enqueue(notification, self.class.name, self.id.to_s, opts)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
50
|
# Send all pending notifications.
|
51
51
|
def send_devise_pending_notifications
|
52
|
-
devise_pending_notifications.each do |notification|
|
52
|
+
devise_pending_notifications.each do |notification, opts|
|
53
53
|
# Use `id.to_s` to avoid problems with mongoid 2.4.X ids being serialized
|
54
54
|
# wrong with YAJL.
|
55
|
-
Devise::Async::Worker.enqueue(notification, self.class.name, self.id.to_s)
|
55
|
+
Devise::Async::Worker.enqueue(notification, self.class.name, self.id.to_s, opts)
|
56
56
|
end
|
57
57
|
@devise_pending_notifications = []
|
58
58
|
end
|
data/lib/devise/async/version.rb
CHANGED
data/lib/devise/async/worker.rb
CHANGED
@@ -3,8 +3,8 @@ module Devise
|
|
3
3
|
class Worker
|
4
4
|
# Used is the internal interface for devise-async to enqueue notifications
|
5
5
|
# to the desired backend.
|
6
|
-
def self.enqueue(method, resource_class, resource_id)
|
7
|
-
backend_class.enqueue(method, resource_class, resource_id)
|
6
|
+
def self.enqueue(method, resource_class, resource_id, opts)
|
7
|
+
backend_class.enqueue(method, resource_class, resource_id, opts)
|
8
8
|
end
|
9
9
|
|
10
10
|
private
|
@@ -5,16 +5,16 @@ module Devise
|
|
5
5
|
module Backend
|
6
6
|
describe "Base" do
|
7
7
|
it "delegates to configured mailer" do
|
8
|
-
|
8
|
+
Devise.mailer = "MyMailer"
|
9
9
|
user = create_user
|
10
10
|
mailer_instance = mock(:deliver => true)
|
11
11
|
|
12
12
|
MyMailer.expects(:confirmation_instructions).once.returns(mailer_instance)
|
13
|
-
Base.new.perform(:confirmation_instructions, "User", user.id)
|
13
|
+
Base.new.perform(:confirmation_instructions, "User", user.id, {})
|
14
14
|
end
|
15
15
|
|
16
16
|
after do
|
17
|
-
|
17
|
+
Devise.mailer = "Devise::Mailer"
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -6,16 +6,16 @@ module Devise
|
|
6
6
|
describe "DelayedJob" do
|
7
7
|
it "enqueues job" do
|
8
8
|
delayed_instance = mock()
|
9
|
-
delayed_instance.expects(:perform).once.with(:mailer_method, "User", 123)
|
9
|
+
delayed_instance.expects(:perform).once.with(:mailer_method, "User", 123, {})
|
10
10
|
DelayedJob.any_instance.expects(:delay).once.returns(delayed_instance)
|
11
11
|
|
12
|
-
DelayedJob.enqueue(:mailer_method, "User", 123)
|
12
|
+
DelayedJob.enqueue(:mailer_method, "User", 123, {})
|
13
13
|
end
|
14
14
|
|
15
15
|
it "delegates to devise mailer when delivering" do
|
16
16
|
user = create_user
|
17
17
|
ActionMailer::Base.deliveries = []
|
18
|
-
Backend::DelayedJob.new.perform(:confirmation_instructions, "User", user.id)
|
18
|
+
Backend::DelayedJob.new.perform(:confirmation_instructions, "User", user.id, {})
|
19
19
|
ActionMailer::Base.deliveries.size.must_equal 1
|
20
20
|
end
|
21
21
|
end
|
@@ -7,21 +7,21 @@ module Devise
|
|
7
7
|
it "enqueues job" do
|
8
8
|
::QC::Queue.any_instance.expects(:enqueue).with(
|
9
9
|
"Devise::Async::Backend::QueueClassic.perform",
|
10
|
-
"mailer_method", "User", 123)
|
11
|
-
QueueClassic.enqueue(:mailer_method, "User", 123)
|
10
|
+
"mailer_method", "User", 123, {})
|
11
|
+
QueueClassic.enqueue(:mailer_method, "User", 123, {})
|
12
12
|
end
|
13
13
|
|
14
14
|
it "delegates to devise mailer when delivering" do
|
15
15
|
user = create_user
|
16
16
|
ActionMailer::Base.deliveries = []
|
17
|
-
Backend::QueueClassic.perform(:confirmation_instructions, "User", user.id)
|
17
|
+
Backend::QueueClassic.perform(:confirmation_instructions, "User", user.id, {})
|
18
18
|
ActionMailer::Base.deliveries.size.must_equal 1
|
19
19
|
end
|
20
20
|
|
21
21
|
it "enqueues to configured queue" do
|
22
22
|
queue = mock(:enqueue => nil)
|
23
23
|
::QC::Queue.expects(:new).with(:custom_queue).once.returns(queue)
|
24
|
-
QueueClassic.enqueue(:mailer_method, "User", 123)
|
24
|
+
QueueClassic.enqueue(:mailer_method, "User", 123, {})
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -5,20 +5,20 @@ module Devise
|
|
5
5
|
module Backend
|
6
6
|
describe "Resque" do
|
7
7
|
it "enqueues job" do
|
8
|
-
::Resque.expects(:enqueue).with(Resque, :mailer_method, "User", 123)
|
9
|
-
Resque.enqueue(:mailer_method, "User", 123)
|
8
|
+
::Resque.expects(:enqueue).with(Resque, :mailer_method, "User", 123, {})
|
9
|
+
Resque.enqueue(:mailer_method, "User", 123, {})
|
10
10
|
end
|
11
11
|
|
12
12
|
it "delegates to devise mailer when delivering" do
|
13
13
|
user = create_user
|
14
14
|
ActionMailer::Base.deliveries = []
|
15
|
-
Backend::Resque.perform(:confirmation_instructions, "User", user.id)
|
15
|
+
Backend::Resque.perform(:confirmation_instructions, "User", user.id, {})
|
16
16
|
ActionMailer::Base.deliveries.size.must_equal 1
|
17
17
|
end
|
18
18
|
|
19
19
|
it "enqueues to configured queue" do
|
20
20
|
expected_size = 1 + ::Resque.size(:custom_queue)
|
21
|
-
Resque.enqueue(:mailer_method, "User", 123)
|
21
|
+
Resque.enqueue(:mailer_method, "User", 123, {})
|
22
22
|
::Resque.size(:custom_queue).must_equal expected_size
|
23
23
|
end
|
24
24
|
end
|
@@ -5,20 +5,20 @@ module Devise
|
|
5
5
|
module Backend
|
6
6
|
describe "Sidekiq" do
|
7
7
|
it "enqueues job" do
|
8
|
-
Sidekiq.expects(:perform_async).with(:mailer_method, "User", 123)
|
9
|
-
Sidekiq.enqueue(:mailer_method, "User", 123)
|
8
|
+
Sidekiq.expects(:perform_async).with(:mailer_method, "User", 123, {})
|
9
|
+
Sidekiq.enqueue(:mailer_method, "User", 123, {})
|
10
10
|
end
|
11
11
|
|
12
12
|
it "delegates to devise mailer when delivering" do
|
13
13
|
user = create_user
|
14
14
|
ActionMailer::Base.deliveries = []
|
15
|
-
Backend::Sidekiq.new.perform(:confirmation_instructions, "User", user.id)
|
15
|
+
Backend::Sidekiq.new.perform(:confirmation_instructions, "User", user.id, {})
|
16
16
|
ActionMailer::Base.deliveries.size.must_equal 1
|
17
17
|
end
|
18
18
|
|
19
19
|
it "enqueues to configured queue" do
|
20
20
|
expected_size = 1 + Sidekiq.jobs.size
|
21
|
-
Sidekiq.enqueue(:mailer_method, "User", 123)
|
21
|
+
Sidekiq.enqueue(:mailer_method, "User", 123, {})
|
22
22
|
Sidekiq.jobs.size.must_equal expected_size
|
23
23
|
end
|
24
24
|
end
|
@@ -6,22 +6,22 @@ module Devise
|
|
6
6
|
it "accumulates notifications to be sent after commit on Model creation" do
|
7
7
|
Admin.transaction do
|
8
8
|
admin = create_admin
|
9
|
-
admin.send(:devise_pending_notifications).must_equal [:confirmation_instructions]
|
9
|
+
admin.send(:devise_pending_notifications).must_equal [[:confirmation_instructions, {}]]
|
10
10
|
end
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
it "immediately sends notifications when the model has not changed" do
|
14
14
|
admin = create_admin
|
15
|
-
Worker.expects(:enqueue).with(:confirmation_instructions, "Admin", admin.id.to_s)
|
15
|
+
Worker.expects(:enqueue).with(:confirmation_instructions, "Admin", admin.id.to_s, {})
|
16
16
|
admin.send_confirmation_instructions
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
it "accumulates notifications to be sent after commit when Model has been changed" do
|
20
20
|
admin = create_admin
|
21
21
|
Admin.transaction do
|
22
22
|
admin[:username] = "changed_username"
|
23
23
|
admin.send_confirmation_instructions
|
24
|
-
admin.send(:devise_pending_notifications).must_equal [:confirmation_instructions]
|
24
|
+
admin.send(:devise_pending_notifications).must_equal [[:confirmation_instructions, {}]]
|
25
25
|
Worker.expects(:enqueue).never # after_commit will not fire without save
|
26
26
|
end
|
27
27
|
end
|
@@ -31,9 +31,9 @@ module Devise
|
|
31
31
|
Admin.transaction do
|
32
32
|
admin[:username] = "changed_username"
|
33
33
|
admin.send_confirmation_instructions
|
34
|
-
admin.send(:devise_pending_notifications).must_equal [:confirmation_instructions]
|
34
|
+
admin.send(:devise_pending_notifications).must_equal [[:confirmation_instructions, {}]]
|
35
35
|
admin.save
|
36
|
-
Worker.expects(:enqueue).with(:confirmation_instructions, "Admin", admin.id.to_s)
|
36
|
+
Worker.expects(:enqueue).with(:confirmation_instructions, "Admin", admin.id.to_s, {})
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -6,29 +6,29 @@ module Devise
|
|
6
6
|
it "enqueues job using the resque backend" do
|
7
7
|
Devise::Async.backend = :resque
|
8
8
|
|
9
|
-
Backend::Resque.expects(:enqueue).with(:mailer_method, "User", 123)
|
10
|
-
Worker.enqueue(:mailer_method, "User", 123)
|
9
|
+
Backend::Resque.expects(:enqueue).with(:mailer_method, "User", 123, {})
|
10
|
+
Worker.enqueue(:mailer_method, "User", 123, {})
|
11
11
|
end
|
12
12
|
|
13
13
|
it "enqueues job using the sidekiq backend" do
|
14
14
|
Devise::Async.backend = :sidekiq
|
15
15
|
|
16
|
-
Backend::Sidekiq.expects(:enqueue).with(:mailer_method, "User", 123)
|
17
|
-
Worker.enqueue(:mailer_method, "User", 123)
|
16
|
+
Backend::Sidekiq.expects(:enqueue).with(:mailer_method, "User", 123, {})
|
17
|
+
Worker.enqueue(:mailer_method, "User", 123, {})
|
18
18
|
end
|
19
19
|
|
20
20
|
it "enqueues job using the delayed job backend" do
|
21
21
|
Devise::Async.backend = :delayed_job
|
22
22
|
|
23
|
-
Backend::DelayedJob.expects(:enqueue).with(:mailer_method, "User", 123)
|
24
|
-
Worker.enqueue(:mailer_method, "User", 123)
|
23
|
+
Backend::DelayedJob.expects(:enqueue).with(:mailer_method, "User", 123, {})
|
24
|
+
Worker.enqueue(:mailer_method, "User", 123, {})
|
25
25
|
end
|
26
26
|
|
27
27
|
it "enqueues job using the queue classic backend" do
|
28
28
|
Devise::Async.backend = :queue_classic
|
29
29
|
|
30
|
-
Backend::QueueClassic.expects(:enqueue).with(:mailer_method, "User", 123)
|
31
|
-
Worker.enqueue(:mailer_method, "User", 123)
|
30
|
+
Backend::QueueClassic.expects(:enqueue).with(:mailer_method, "User", 123, {})
|
31
|
+
Worker.enqueue(:mailer_method, "User", 123, {})
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
data/test/devise/async_test.rb
CHANGED
@@ -11,14 +11,8 @@ module Devise
|
|
11
11
|
Async.backend.must_equal :something
|
12
12
|
end
|
13
13
|
|
14
|
-
it "stores mailer config" do
|
15
|
-
Async.mailer = "MyMailer"
|
16
|
-
Async.mailer.must_equal "MyMailer"
|
17
|
-
end
|
18
|
-
|
19
14
|
after do
|
20
15
|
Async.backend = :resque
|
21
|
-
Async.mailer = "Devise::Mailer"
|
22
16
|
end
|
23
17
|
end
|
24
18
|
end
|
data/test/support/helpers.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
def valid_attributes(attributes={})
|
2
2
|
{ :username => "usertest",
|
3
3
|
:email => generate_unique_email,
|
4
|
-
:password => '
|
5
|
-
:password_confirmation => '
|
4
|
+
:password => '12345678',
|
5
|
+
:password_confirmation => '12345678' }.update(attributes)
|
6
6
|
end
|
7
7
|
|
8
8
|
def generate_unique_email
|
@@ -8,7 +8,7 @@ Devise.setup do |config|
|
|
8
8
|
|
9
9
|
# Configure the class responsible to send e-mails.
|
10
10
|
# config.mailer = "Devise::Mailer"
|
11
|
-
config.mailer = "Devise::
|
11
|
+
# config.mailer = "Devise::Mailer"
|
12
12
|
|
13
13
|
# ==> ORM configuration
|
14
14
|
# Load and configure the ORM. Supports :active_record (default) and
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise-async
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -18,10 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
22
|
-
- - <
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version: 2.2.0
|
21
|
+
version: '2.2'
|
25
22
|
type: :runtime
|
26
23
|
prerelease: false
|
27
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,10 +26,7 @@ dependencies:
|
|
29
26
|
requirements:
|
30
27
|
- - ! '>='
|
31
28
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
33
|
-
- - <
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version: 2.2.0
|
29
|
+
version: '2.2'
|
36
30
|
- !ruby/object:Gem::Dependency
|
37
31
|
name: activerecord
|
38
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -218,7 +212,6 @@ files:
|
|
218
212
|
- lib/devise/async/backend/resque.rb
|
219
213
|
- lib/devise/async/backend/sidekiq.rb
|
220
214
|
- lib/devise/async/model.rb
|
221
|
-
- lib/devise/async/proxy.rb
|
222
215
|
- lib/devise/async/version.rb
|
223
216
|
- lib/devise/async/worker.rb
|
224
217
|
- test/devise/async/backend/base_test.rb
|
@@ -228,7 +221,6 @@ files:
|
|
228
221
|
- test/devise/async/backend/sidekiq_test.rb
|
229
222
|
- test/devise/async/backend_test.rb
|
230
223
|
- test/devise/async/model_test.rb
|
231
|
-
- test/devise/async/proxy_test.rb
|
232
224
|
- test/devise/async/worker_test.rb
|
233
225
|
- test/devise/async_test.rb
|
234
226
|
- test/support/helpers.rb
|
@@ -257,7 +249,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
257
249
|
version: '0'
|
258
250
|
segments:
|
259
251
|
- 0
|
260
|
-
hash:
|
252
|
+
hash: 1115023412629133850
|
261
253
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
262
254
|
none: false
|
263
255
|
requirements:
|
@@ -266,7 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
266
258
|
version: '0'
|
267
259
|
segments:
|
268
260
|
- 0
|
269
|
-
hash:
|
261
|
+
hash: 1115023412629133850
|
270
262
|
requirements: []
|
271
263
|
rubyforge_project:
|
272
264
|
rubygems_version: 1.8.23
|
@@ -283,7 +275,6 @@ test_files:
|
|
283
275
|
- test/devise/async/backend/sidekiq_test.rb
|
284
276
|
- test/devise/async/backend_test.rb
|
285
277
|
- test/devise/async/model_test.rb
|
286
|
-
- test/devise/async/proxy_test.rb
|
287
278
|
- test/devise/async/worker_test.rb
|
288
279
|
- test/devise/async_test.rb
|
289
280
|
- test/support/helpers.rb
|
data/lib/devise/async/proxy.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
module Devise
|
2
|
-
module Async
|
3
|
-
class Proxy
|
4
|
-
# Catches all devise emails
|
5
|
-
def self.method_missing(method, *args, &block)
|
6
|
-
new(method, args.first)
|
7
|
-
end
|
8
|
-
|
9
|
-
def initialize(method, resource)
|
10
|
-
@method, @resource = method, resource
|
11
|
-
end
|
12
|
-
|
13
|
-
def deliver
|
14
|
-
# Use `id.to_s` to avoid problems with mongoid 2.4.X ids being serialized
|
15
|
-
# wrong with YAJL.
|
16
|
-
Worker.enqueue(@method, @resource.class.name, @resource.id.to_s)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
module Devise
|
4
|
-
module Async
|
5
|
-
describe "Proxy" do
|
6
|
-
it "gets called by devise operations and proxy to worker" do
|
7
|
-
user = create_user
|
8
|
-
Worker.expects(:enqueue).with(:confirmation_instructions, "User", user.id.to_s)
|
9
|
-
user.send_confirmation_instructions
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|