devise_invitable 2.0.12 → 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: 73e4a8fc4cdc87b6f5397619a737fe13c6376b9534bf9ba810d9e2355bc2b588
4
- data.tar.gz: 8dac212d256560b1cafff5e9193ffe72ddb988e52cb232a630668ac883d1b4ff
3
+ metadata.gz: e29dc7f305f5cb11941463a2115645c6de83ac0fde470243f8c4ee9c23535c7f
4
+ data.tar.gz: 1351e523f14e6dcb0243df3a6b0eca0156e0185e25fd488335c8acf4b260c7b7
5
5
  SHA512:
6
- metadata.gz: 359b97a7be863db6e484282887e075723011b5d06fd38a02f7e5a761872a6a002838776bd46c082c3f94360f53e2248a8432a5a7cabdae6ba7d457db42ef7168
7
- data.tar.gz: 848f10d801857bdb53d64348c3492a7d2e227611deab7d62d54af567eb03310787a4f2533b2366c236e0e54b701aa32642ee9f084aaa26ea44145ea8bd44ad2e
6
+ metadata.gz: 667c2b93fe46151947c3845fd19c4b370d5c9435331cc84ef52e2d375ba06e9748aa57539333b7951dd8b6a09ae6ebdc8ad8e9bb177b5e5d7741bec1691f9b6a
7
+ data.tar.gz: a7403ae4e341a1a1eaf8431addfc9336534ef1fbaacee60614880f0fa94d772bface4433929088c7025766c264c8820b5608914eabb1f8a76624b2ea6116a62c
@@ -3,7 +3,7 @@ zh-HK:
3
3
  failure:
4
4
  invited: "你有一個待處理的邀請, 請接受它以完成創建您的帳戶。"
5
5
  invitations:
6
- send_instructions: "邀請電子郵件已發送到%{email)。"
6
+ send_instructions: "邀請電子郵件已發送到%{email}。"
7
7
  invitation_token_invalid: "提供嘅邀請令牌無效!"
8
8
  updated: "你嘅密碼設置成功。 你而家已經登錄。"
9
9
  updated_not_active: "你嘅密碼設置成功。"
@@ -3,7 +3,7 @@ zh-TW:
3
3
  failure:
4
4
  invited: "你有一封設立帳號的邀請,請接受邀請來創建你的帳號。"
5
5
  invitations:
6
- send_instructions: "邀請已發送至%{email)"
6
+ send_instructions: "邀請已發送至%{email}"
7
7
  invitation_token_invalid: "所提供的邀請驗證無效!"
8
8
  updated: "你的密碼已設置成功,現在你已經登入了。"
9
9
  updated_not_active: "密碼設置成功"
@@ -5,14 +5,11 @@ module DeviseInvitable
5
5
  include DeviseInvitable::Controllers::Helpers
6
6
  end
7
7
 
8
- # We use to_prepare instead of after_initialize here because Devise is a Rails engine; its
9
- # mailer is reloaded like the rest of the user's app. Got to make sure that our mailer methods
10
- # are included each time Devise.mailer is (re)loaded.
11
- config.to_prepare do
12
- Devise.mailer.send :include, DeviseInvitable::Mailer
13
- unless Devise.mailer.ancestors.include?(Devise::Mailers::Helpers)
14
- Devise.mailer.send :include, Devise::Mailers::Helpers
15
- 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
16
13
  end
17
14
  # extend mapping with after_initialize because it's not reloaded
18
15
  config.after_initialize do
@@ -1,3 +1,3 @@
1
1
  module DeviseInvitable
2
- VERSION = '2.0.12'.freeze
2
+ VERSION = '2.0.14'.freeze
3
3
  end
@@ -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
@@ -0,0 +1,2 @@
1
+ class ApplicationMailer < ActionMailer::Base
2
+ 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.12
4
+ version: 2.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio Cambra
@@ -43,14 +43,14 @@ dependencies:
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '2.0'
46
+ version: '4.0'
47
47
  type: :development
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '2.0'
53
+ version: '4.0'
54
54
  description: It adds support for send invitations by email (it requires to be authenticated)
55
55
  and accept the invitation by setting a password.
56
56
  email:
@@ -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