devise-async 1.0.0beta → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d0faaf77bf8419f09993b61edb2b44e0bca1a7e
4
- data.tar.gz: 200860ed39d65593dc110ddc46927cf8e736dd7e
3
+ metadata.gz: 9b371e54937dd66d336e24152c8a3bdd30cbc24e
4
+ data.tar.gz: 0d066d3fab7d1d1b8d564691688bb88273582a62
5
5
  SHA512:
6
- metadata.gz: 14dbc73e63bbf8b6286a335cf1a2dd4b8c244e0bd2e70925feefe50652230c43b38232ee1672b5b0759488ab35cd0950ca7276eb149d9ef71ab80459950c5ef3
7
- data.tar.gz: 32ab6b13c47b1059a826b49009b53c430578acce8c0e7ef48c47ae7c84cf8597122a099a5820b4e254ccb4176f29cd766b38ccfb6f94c42bd2fb505e11314849
6
+ metadata.gz: dba241c296c5001d81a8848c0747cf5402dac71c20f099c936e6b12c53237ee0b693f99f92ac47b81891bfeb37cb2eba429b0bdd4a6bd0eaf4fb3e70d11e1534
7
+ data.tar.gz: 8c4372972c8303580626d9c12406d70770fce86d22fb569f2c30fc45fd7d15a42408e6194e8ffc9213840b71ab701515d33d2685681f98dbea595b6e919d58da
@@ -6,3 +6,5 @@ rvm:
6
6
 
7
7
  before_install:
8
8
  - gem install bundler -v 1.15
9
+
10
+ script: bundle exec rspec
@@ -1,3 +1,7 @@
1
+ ## 1.0.0
2
+
3
+ * Updates the readme
4
+
1
5
  ## 1.0.0beta
2
6
 
3
7
  * Adds support for Rails 5
data/README.md CHANGED
@@ -2,18 +2,7 @@
2
2
 
3
3
  [![Tag](https://img.shields.io/github/tag/mhfs/devise-async.svg?style=flat-square)](https://github.com/mhfs/devise-async/releases) [![Build Status](https://img.shields.io/travis/mhfs/devise-async.svg?style=flat-square)](https://travis-ci.org/mhfs/devise-async) [![Code Climate](https://img.shields.io/codeclimate/github/mhfs/devise-async.svg?style=flat-square)](https://codeclimate.com/github/mhfs/devise-async)
4
4
 
5
- Devise Async provides an easy way to configure Devise to send its emails asynchronously using your preferred queuing backend.
6
-
7
- Supported backends:
8
-
9
- * Resque
10
- * Sidekiq
11
- * Delayed::Job
12
- * QueueClassic
13
- * Torquebox
14
- * Backburner
15
- * Que
16
- * SuckerPunch
5
+ Devise Async provides an easy way to configure Devise to send its emails asynchronously using ActiveJob.
17
6
 
18
7
  ## Installation
19
8
 
@@ -33,7 +22,8 @@ Or install it yourself as:
33
22
 
34
23
  ## Usage
35
24
 
36
- Add `:async` to the `devise` call in your model:
25
+ 1. Setup [ActiveJob](http://edgeguides.rubyonrails.org/active_job_basics.html),
26
+ 2. Add `:async` to the `devise` call in your model:
37
27
 
38
28
  ```ruby
39
29
  class User < ActiveRecord::Base
@@ -41,16 +31,7 @@ class User < ActiveRecord::Base
41
31
  end
42
32
  ```
43
33
 
44
- Set your queuing backend by creating `config/initializers/devise_async.rb`:
45
-
46
- ```ruby
47
- # Supported options: :resque, :sidekiq, :delayed_job, :queue_classic, :torquebox, :backburner, :que, :sucker_punch
48
- Devise::Async.backend = :resque
49
- ```
50
-
51
- Tip: it defaults to Resque. You don't need to create the initializer if using it.
52
-
53
- ## Advanced Options
34
+ ## Options
54
35
 
55
36
  ### Enabling via config
56
37
 
@@ -61,33 +42,6 @@ The gem can be enabled/disabled easily via config, for example based on environm
61
42
  Devise::Async.enabled = true # | false
62
43
  ```
63
44
 
64
- ### Custom mailer class
65
-
66
- Customize `Devise.mailer` at will and `devise-async` will honor it.
67
-
68
- Upgrade note: if you're upgrading from any version < 0.6 and getting errors
69
- trying to set `Devise::Async.mailer` just use `Devise.mailer` instead.
70
-
71
- ### Custom queue
72
-
73
- Let you specify a custom queue where to enqueue your background Devise jobs.
74
- Defaults to :mailer.
75
-
76
- ```ruby
77
- # config/initializers/devise_async.rb
78
- Devise::Async.queue = :my_custom_queue
79
- ```
80
-
81
- ### Custom priority
82
-
83
- You can specify a custom priority for created background jobs in Devise or Backburner.
84
- If no value is specified, jobs will be enqueued with whatever default priority is configured in Devise or Backburner.
85
-
86
- ```ruby
87
- # config/initializers/devise_async.rb
88
- Devise::Async.priority = 10
89
- ```
90
-
91
45
  ### Setup via block
92
46
 
93
47
  To avoid repeating `Devise::Async` in the initializer file you can use the block syntax
@@ -97,40 +51,22 @@ similar to what `Devise` offers.
97
51
  # config/initializers/devise_async.rb
98
52
  Devise::Async.setup do |config|
99
53
  config.enabled = true
100
- config.backend = :resque
101
- config.queue = :my_custom_queue
102
- end
103
- ```
104
-
105
- ## Troubleshooting
106
-
107
- If you are using Sidekiq and your jobs are enqueued but not processed you might need to set a queue explicitly:
108
-
109
- ```ruby
110
- # config/initializers/devise_async.rb
111
- Devise::Async.setup do |config|
112
- config.backend = :sidekiq
113
- config.queue = :default
114
54
  end
115
55
  ```
116
56
 
117
- ## Testing
118
-
119
- Be aware that since version 0.3.0 devise-async enqueues the background job in active
120
- record's `after_commit` hook. If you're using rspec's `use_transactional_fixtures` the jobs
121
- might not be enqueued as you'd expect.
57
+ ### Custom mailer class
122
58
 
123
- More details in this stackoverflow [thread](http://stackoverflow.com/questions/13406248/how-do-i-get-devise-async-working-with-cucumber/13465089#13465089).
59
+ Customize `Devise.mailer` at will and `devise-async` will honor it.
124
60
 
125
- ## Devise < 2.2
61
+ ## Older versions of Rails and devise
126
62
 
127
- 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.
63
+ If you want to use this gem with Rails < 5 and/or devise < 4 check out older releases, please.
128
64
 
129
- Please refer to that branch README for further info.
65
+ ## Testing
130
66
 
131
- ## Devise >= 4.0
67
+ RSpec is used for testing. The following should be enough for running the test:
132
68
 
133
- The current state of this gem does not support Devise 4.0 and up. Have a look into [the Github issue](https://github.com/mhfs/devise-async/issues/94) addressing this. If you are in need for a solution to send Devise messages delayed [a switch to ActiveJob](https://github.com/plataformatec/devise#activejob-integration) is strongly advised.
69
+ $ bundle exec rspec
134
70
 
135
71
  ## Contributing
136
72
 
data/Rakefile CHANGED
@@ -1,14 +1,3 @@
1
1
  #!/usr/bin/env rake
2
2
 
3
3
  require "bundler/gem_tasks"
4
- require "rake/testtask"
5
-
6
- task :default => :test
7
-
8
- Rake::TestTask.new do |t|
9
- t.libs << "lib"
10
- t.libs << "test"
11
- t.test_files = FileList["test/**/*_test.rb"]
12
- t.verbose = true
13
- t.warning = false
14
- end
@@ -1,5 +1,5 @@
1
1
  module Devise
2
2
  module Async
3
- VERSION = '1.0.0beta'
3
+ VERSION = '1.0.0'
4
4
  end
5
5
  end
@@ -1,14 +1,12 @@
1
1
  RSpec.describe Devise::Models::Async do
2
- before :each do
2
+ before do
3
3
  ActiveJob::Base.queue_adapter = :test
4
4
  end
5
5
 
6
6
  context 'with unchanged model' do
7
- subject { create_admin }
7
+ subject { admin }
8
8
 
9
- before :each do
10
- subject
11
- end
9
+ let!(:admin) { create_admin }
12
10
 
13
11
  it 'enqueues notifications immediately when the model did not change' do
14
12
  expect(ActionMailer::DeliveryJob).to have_been_enqueued
@@ -47,7 +45,7 @@ RSpec.describe Devise::Models::Async do
47
45
  end
48
46
 
49
47
  context 'with saving the model' do
50
- let(:save_admin) { admin.save }
48
+ let(:saved_admin) { admin.save }
51
49
 
52
50
  it 'accumulates a pending notification to be sent after commit' do
53
51
  expect(subject).to eq([
@@ -59,13 +57,13 @@ RSpec.describe Devise::Models::Async do
59
57
  subject
60
58
 
61
59
  expect {
62
- save_admin
60
+ saved_admin
63
61
  }.to have_enqueued_job(ActionMailer::DeliveryJob)
64
62
  end
65
63
 
66
64
  it 'forwards the correct data to the job' do
67
65
  subject
68
- save_admin
66
+ saved_admin
69
67
 
70
68
  job_data = ActiveJob::Base.queue_adapter.enqueued_jobs.first[:args]
71
69
  expected_job_data = ['Devise::Mailer', 'confirmation_instructions', admin.send(:confirmation_token)]
@@ -76,7 +74,7 @@ RSpec.describe Devise::Models::Async do
76
74
  end
77
75
 
78
76
  context 'when devise async is disabled' do
79
- around :each do |example|
77
+ around do |example|
80
78
  Devise::Async.enabled = false
81
79
  example.run
82
80
  Devise::Async.enabled = true
@@ -18,6 +18,6 @@ RSpec.configure do |config|
18
18
  config.include TestHelpers
19
19
 
20
20
  config.before :each do
21
- load File.dirname(__FILE__) + '/support/rails_app/db/schema.rb'
21
+ load "#{File.dirname(__FILE__)}/support/rails_app/db/schema.rb"
22
22
  end
23
23
  end
@@ -11,7 +11,7 @@ RSpec.configure do |config|
11
11
  config.filter_run_when_matching :focus
12
12
  config.example_status_persistence_file_path = "spec/examples.txt"
13
13
  config.disable_monkey_patching!
14
- config.warnings = true
14
+ config.warnings = false
15
15
  config.order = :random
16
16
 
17
17
  if config.files_to_run.one?
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: 1.0.0beta
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Oelke
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-05-25 00:00:00.000000000 Z
12
+ date: 2017-09-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: devise
@@ -185,9 +185,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
185
185
  version: '0'
186
186
  required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  requirements:
188
- - - ">"
188
+ - - ">="
189
189
  - !ruby/object:Gem::Version
190
- version: 1.3.1
190
+ version: '0'
191
191
  requirements: []
192
192
  rubyforge_project:
193
193
  rubygems_version: 2.4.5.1