devise_invitable 2.0.13 → 2.0.14
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.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e29dc7f305f5cb11941463a2115645c6de83ac0fde470243f8c4ee9c23535c7f
|
|
4
|
+
data.tar.gz: 1351e523f14e6dcb0243df3a6b0eca0156e0185e25fd488335c8acf4b260c7b7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 667c2b93fe46151947c3845fd19c4b370d5c9435331cc84ef52e2d375ba06e9748aa57539333b7951dd8b6a09ae6ebdc8ad8e9bb177b5e5d7741bec1691f9b6a
|
|
7
|
+
data.tar.gz: a7403ae4e341a1a1eaf8431addfc9336534ef1fbaacee60614880f0fa94d772bface4433929088c7025766c264c8820b5608914eabb1f8a76624b2ea6116a62c
|
|
@@ -5,22 +5,11 @@ module DeviseInvitable
|
|
|
5
5
|
include DeviseInvitable::Controllers::Helpers
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
#
|
|
9
|
-
# mailer
|
|
10
|
-
#
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
# Devise.mailer (a String#constantize) doesn't force ActionMailer::Base to load
|
|
14
|
-
# before app initialization completes. Without this wrapper, Rails edge's
|
|
15
|
-
# guard_load_hooks support (rails/rails#56201) logs an early-load-hook warning
|
|
16
|
-
# for :action_mailer (and :active_job, via MailDeliveryJob) on every boot.
|
|
17
|
-
config.to_prepare do
|
|
18
|
-
ActiveSupport.on_load(:action_mailer) do
|
|
19
|
-
Devise.mailer.send :include, DeviseInvitable::Mailer
|
|
20
|
-
unless Devise.mailer.ancestors.include?(Devise::Mailers::Helpers)
|
|
21
|
-
Devise.mailer.send :include, Devise::Mailers::Helpers
|
|
22
|
-
end
|
|
23
|
-
end
|
|
8
|
+
# Devise::Mailer includes Devise::Mailers::Helpers, so adding our mailer methods there reaches every
|
|
9
|
+
# (re)loaded Devise.mailer without resolving it at boot. Resolving it from an on_load(:action_mailer)
|
|
10
|
+
# hook re-enters the app's parent_mailer while it is still loading (#929).
|
|
11
|
+
initializer "devise_invitable.mailer" do
|
|
12
|
+
Devise::Mailers::Helpers.include DeviseInvitable::Mailer
|
|
24
13
|
end
|
|
25
14
|
# extend mapping with after_initialize because it's not reloaded
|
|
26
15
|
config.after_initialize do
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
require 'open3'
|
|
3
|
+
|
|
4
|
+
class ParentMailerTest < ActiveSupport::TestCase
|
|
5
|
+
APPLICATION = File.expand_path('../rails_app/config/application', __dir__)
|
|
6
|
+
|
|
7
|
+
# Each boot runs in a fresh process: the failure only shows up when nothing has loaded
|
|
8
|
+
# ActionMailer::Base yet, which is never the case inside this test process.
|
|
9
|
+
def boot_with_app_parent_mailer(first_reference)
|
|
10
|
+
script = <<~RUBY
|
|
11
|
+
require #{APPLICATION.inspect}
|
|
12
|
+
Devise.parent_mailer = 'ApplicationMailer'
|
|
13
|
+
RailsApp::Application.initialize!
|
|
14
|
+
#{first_reference}
|
|
15
|
+
print "invitation_instructions=\#{Devise.mailer.method_defined?(:invitation_instructions)}"
|
|
16
|
+
RUBY
|
|
17
|
+
Open3.capture3({ 'RAILS_ENV' => 'test' }, RbConfig.ruby, '-e', script)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
test 'Devise.mailer resolves when the parent mailer is an app mailer' do
|
|
21
|
+
stdout, stderr, status = boot_with_app_parent_mailer('Devise.mailer')
|
|
22
|
+
assert status.success?, stderr
|
|
23
|
+
assert_match(/invitation_instructions=true\z/, stdout)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
test 'the parent mailer can be the first mailer loaded, as with eager loading' do
|
|
27
|
+
stdout, stderr, status = boot_with_app_parent_mailer('ApplicationMailer')
|
|
28
|
+
assert status.success?, stderr
|
|
29
|
+
assert_match(/invitation_instructions=true\z/, stdout)
|
|
30
|
+
end
|
|
31
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: devise_invitable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.14
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sergio Cambra
|
|
@@ -120,6 +120,7 @@ files:
|
|
|
120
120
|
- test/integration/invitation_test.rb
|
|
121
121
|
- test/integration_tests_helper.rb
|
|
122
122
|
- test/mailers/invitation_mail_test.rb
|
|
123
|
+
- test/mailers/parent_mailer_test.rb
|
|
123
124
|
- test/model_tests_helper.rb
|
|
124
125
|
- test/models/invitable_test.rb
|
|
125
126
|
- test/models_test.rb
|
|
@@ -132,6 +133,7 @@ files:
|
|
|
132
133
|
- test/rails_app/app/controllers/home_controller.rb
|
|
133
134
|
- test/rails_app/app/controllers/users_controller.rb
|
|
134
135
|
- test/rails_app/app/helpers/application_helper.rb
|
|
136
|
+
- test/rails_app/app/mailers/application_mailer.rb
|
|
135
137
|
- test/rails_app/app/models/admin.rb
|
|
136
138
|
- test/rails_app/app/models/octopussy.rb
|
|
137
139
|
- test/rails_app/app/models/user.rb
|
|
@@ -199,6 +201,7 @@ test_files:
|
|
|
199
201
|
- test/integration/invitation_test.rb
|
|
200
202
|
- test/integration_tests_helper.rb
|
|
201
203
|
- test/mailers/invitation_mail_test.rb
|
|
204
|
+
- test/mailers/parent_mailer_test.rb
|
|
202
205
|
- test/model_tests_helper.rb
|
|
203
206
|
- test/models/invitable_test.rb
|
|
204
207
|
- test/models_test.rb
|
|
@@ -211,6 +214,7 @@ test_files:
|
|
|
211
214
|
- test/rails_app/app/controllers/home_controller.rb
|
|
212
215
|
- test/rails_app/app/controllers/users_controller.rb
|
|
213
216
|
- test/rails_app/app/helpers/application_helper.rb
|
|
217
|
+
- test/rails_app/app/mailers/application_mailer.rb
|
|
214
218
|
- test/rails_app/app/models/admin.rb
|
|
215
219
|
- test/rails_app/app/models/octopussy.rb
|
|
216
220
|
- test/rails_app/app/models/user.rb
|