devise_invitable 2.0.0 → 2.0.8
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 +4 -4
- data/CHANGELOG.md +32 -0
- data/README.rdoc +88 -37
- data/app/controllers/devise/invitations_controller.rb +33 -32
- data/app/controllers/devise_invitable/registrations_controller.rb +11 -11
- data/app/views/devise/invitations/edit.html.erb +1 -1
- data/app/views/devise/mailer/invitation_instructions.html.erb +1 -1
- data/app/views/devise/mailer/invitation_instructions.text.erb +1 -1
- data/config/locales/ar.yml +23 -0
- data/config/locales/ca.yml +32 -0
- data/config/locales/da.yml +41 -0
- data/config/locales/de.yml +31 -0
- data/config/locales/es.yml +31 -0
- data/config/locales/et.yml +23 -0
- data/config/locales/fa.yml +31 -0
- data/config/locales/fr.yml +34 -0
- data/config/locales/it.yml +31 -0
- data/config/locales/ja.yml +31 -0
- data/config/locales/ko.yml +24 -0
- data/config/locales/nl.yml +32 -0
- data/config/locales/no.yml +17 -0
- data/config/locales/pl.yml +31 -0
- data/config/locales/pt-BR.yml +23 -0
- data/config/locales/pt.yml +23 -0
- data/config/locales/ru.yml +23 -0
- data/config/locales/tr.yml +24 -0
- data/config/locales/ua.yml +31 -0
- data/config/locales/vi.yml +25 -0
- data/config/locales/zh-HK.yml +31 -0
- data/config/locales/zh-TW.yml +31 -0
- data/lib/devise_invitable/controllers/helpers.rb +7 -4
- data/lib/devise_invitable/inviter.rb +4 -3
- data/lib/devise_invitable/mapping.rb +8 -5
- data/lib/devise_invitable/models/authenticatable.rb +7 -1
- data/lib/devise_invitable/models.rb +16 -13
- data/lib/devise_invitable/parameter_sanitizer.rb +18 -18
- data/lib/devise_invitable/routes.rb +1 -1
- data/lib/devise_invitable/version.rb +1 -1
- data/lib/devise_invitable.rb +2 -1
- data/lib/generators/active_record/templates/migration.rb +0 -1
- data/lib/generators/devise_invitable/devise_invitable_generator.rb +1 -1
- data/lib/generators/devise_invitable/install_generator.rb +4 -3
- data/test/functional/controller_helpers_test.rb +10 -0
- data/test/generators/views_generator_test.rb +7 -6
- data/test/generators_test.rb +3 -2
- data/test/integration/invitation_test.rb +1 -1
- data/test/integration_tests_helper.rb +0 -1
- data/test/mailers/invitation_mail_test.rb +1 -1
- data/test/model_tests_helper.rb +1 -1
- data/test/models/invitable_test.rb +27 -11
- data/test/orm/active_record.rb +6 -1
- data/test/rails_app/app/controllers/admins_controller.rb +4 -3
- data/test/rails_app/app/controllers/application_controller.rb +10 -9
- data/test/rails_app/app/controllers/free_invitations_controller.rb +12 -9
- data/test/rails_app/config/initializers/devise.rb +4 -3
- data/test/rails_app/config/initializers/secret_token.rb +9 -0
- data/test/rails_app/db/migrate/20100401102949_create_tables.rb +0 -2
- data/test/test_helper.rb +5 -18
- metadata +32 -9
data/lib/devise_invitable.rb
CHANGED
|
@@ -22,7 +22,8 @@ module Devise
|
|
|
22
22
|
mattr_accessor :invite_for
|
|
23
23
|
@@invite_for = 0
|
|
24
24
|
|
|
25
|
-
# Public:
|
|
25
|
+
# Public: Ensure that invited record is valid.
|
|
26
|
+
# The invitation won't be sent if this check fails.
|
|
26
27
|
# (default: false).
|
|
27
28
|
#
|
|
28
29
|
# Examples (in config/initializers/devise.rb)
|
|
@@ -8,7 +8,6 @@ class DeviseInvitableAddTo<%= table_name.camelize %> < ActiveRecord::Migration<%
|
|
|
8
8
|
t.integer :invitation_limit
|
|
9
9
|
t.references :invited_by, polymorphic: true
|
|
10
10
|
t.integer :invitations_count, default: 0
|
|
11
|
-
t.index :invitations_count
|
|
12
11
|
t.index :invitation_token, unique: true # for invitable
|
|
13
12
|
t.index :invited_by_id
|
|
14
13
|
end
|
|
@@ -7,7 +7,7 @@ module DeviseInvitable
|
|
|
7
7
|
|
|
8
8
|
def inject_devise_invitable_content
|
|
9
9
|
path = File.join('app', 'models', "#{file_path}.rb")
|
|
10
|
-
inject_into_file(path, 'invitable, :', after: 'devise :') if File.
|
|
10
|
+
inject_into_file(path, 'invitable, :', after: 'devise :') if File.exist?(path)
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
hook_for :orm
|
|
@@ -15,8 +15,8 @@ module DeviseInvitable
|
|
|
15
15
|
inject_into_file(devise_initializer_path, before: " # ==> Configuration for :confirmable\n") do
|
|
16
16
|
<<-CONTENT
|
|
17
17
|
# ==> Configuration for :invitable
|
|
18
|
-
# The period the generated invitation token is valid
|
|
19
|
-
# this period, the invited resource won't be able to accept the invitation.
|
|
18
|
+
# The period the generated invitation token is valid.
|
|
19
|
+
# After this period, the invited resource won't be able to accept the invitation.
|
|
20
20
|
# When invite_for is 0 (the default), the invitation won't expire.
|
|
21
21
|
# config.invite_for = 2.weeks
|
|
22
22
|
|
|
@@ -35,7 +35,8 @@ module DeviseInvitable
|
|
|
35
35
|
# config.invite_key = { email: /\\A[^@]+@[^@]+\\z/ }
|
|
36
36
|
# config.invite_key = { email: /\\A[^@]+@[^@]+\\z/, username: nil }
|
|
37
37
|
|
|
38
|
-
#
|
|
38
|
+
# Ensure that invited record is valid.
|
|
39
|
+
# The invitation won't be sent if this check fails.
|
|
39
40
|
# Default: false
|
|
40
41
|
# config.validate_on_invite = true
|
|
41
42
|
|
|
@@ -41,4 +41,14 @@ class ControllerHelpersTest < ActionController::TestCase
|
|
|
41
41
|
assert Devise::InvitationsController.method_defined? :after_accept_path_for
|
|
42
42
|
assert !Devise::InvitationsController.instance_methods(false).include?(:after_accept_path_for)
|
|
43
43
|
end
|
|
44
|
+
|
|
45
|
+
test 'invalid token path defaults to after sign out path' do
|
|
46
|
+
assert_equal @controller.send(:after_sign_out_path_for, :user), @controller.invalid_token_path_for(:user)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
test 'invalid token path is customizable from application controller' do
|
|
50
|
+
custom_path = 'customized/invalid/token/path'
|
|
51
|
+
@controller.instance_eval "def invalid_token_path_for(resource_name) '#{custom_path}' end"
|
|
52
|
+
assert_equal @controller.invalid_token_path_for(:user), custom_path
|
|
53
|
+
end
|
|
44
54
|
end
|
|
@@ -28,13 +28,14 @@ class ViewsGeneratorTest < ::Rails::Generators::TestCase
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
private
|
|
31
|
-
def assert_files
|
|
32
|
-
assert views = { @invitations_path => %w/edit.html.erb new.html.erb/, @mailer_path => %w/invitation_instructions.html.erb/ }
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
def assert_files
|
|
33
|
+
assert views = { @invitations_path => %w/edit.html.erb new.html.erb/, @mailer_path => %w/invitation_instructions.html.erb/ }
|
|
34
|
+
|
|
35
|
+
views.each do |path, files|
|
|
36
|
+
files.each do |file|
|
|
37
|
+
assert_file File.join path, file
|
|
38
|
+
end
|
|
37
39
|
end
|
|
38
40
|
end
|
|
39
|
-
end
|
|
40
41
|
end
|
data/test/generators_test.rb
CHANGED
|
@@ -17,13 +17,14 @@ class GeneratorsTest < ActiveSupport::TestCase
|
|
|
17
17
|
|
|
18
18
|
test "rails g devise_invitable:install" do
|
|
19
19
|
@output = `cd #{RAILS_APP_PATH} && rails g devise_invitable:install -p`
|
|
20
|
-
|
|
20
|
+
puts @output
|
|
21
|
+
assert @output.match(%r{(inject|insert|File unchanged! The supplied flag value not found!).* config/initializers/devise\.rb\n})
|
|
21
22
|
assert @output.match(%r|create.* config/locales/devise_invitable\.en\.yml\n|)
|
|
22
23
|
end
|
|
23
24
|
|
|
24
25
|
test "rails g devise_invitable Octopussy" do
|
|
25
26
|
@output = `cd #{RAILS_APP_PATH} && rails g devise_invitable Octopussy -p`
|
|
26
|
-
assert @output.match(%r{(inject|insert).* app/models/octopussy\.rb\n})
|
|
27
|
+
assert @output.match(%r{(inject|insert|File unchanged! The supplied flag value not found!).* app/models/octopussy\.rb\n})
|
|
27
28
|
assert @output.match(%r|invoke.* #{DEVISE_ORM}\n|)
|
|
28
29
|
if DEVISE_ORM == :active_record
|
|
29
30
|
assert @output.match(%r|create.* db/migrate/\d{14}_devise_invitable_add_to_octopussies\.rb\n|)
|
|
@@ -98,7 +98,7 @@ class InvitationTest < ActionDispatch::IntegrationTest
|
|
|
98
98
|
fill_in 'Password confirmation', with: 'other_password'
|
|
99
99
|
end
|
|
100
100
|
assert_equal user_invitation_path, current_path
|
|
101
|
-
assert page.has_css?('#error_explanation li', text: /Password .*doesn
|
|
101
|
+
assert page.has_css?('#error_explanation li', text: /Password .*doesn['’]t match/)
|
|
102
102
|
assert !user.confirmed?
|
|
103
103
|
end
|
|
104
104
|
|
|
@@ -29,7 +29,6 @@ class ActionDispatch::IntegrationTest
|
|
|
29
29
|
|
|
30
30
|
# Fix assert_redirect_to in integration sessions because they don't take into
|
|
31
31
|
# account Middleware redirects.
|
|
32
|
-
#
|
|
33
32
|
def assert_redirected_to(url)
|
|
34
33
|
assert [301, 302].include?(@integration_session.status),
|
|
35
34
|
"Expected status to be 301 or 302, got #{@integration_session.status}"
|
|
@@ -102,7 +102,7 @@ class InvitationMailTest < ActionMailer::TestCase
|
|
|
102
102
|
def initialize(*args); end
|
|
103
103
|
def deliver; end
|
|
104
104
|
end
|
|
105
|
-
Devise.mailer = CustomMailer
|
|
105
|
+
Devise.mailer = 'InvitationMailTest::CustomMailer'
|
|
106
106
|
|
|
107
107
|
User.invite!({ email: 'valid@email.com' }, nil, { invited_at: Time.now })
|
|
108
108
|
end
|
data/test/model_tests_helper.rb
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
require 'test_helper'
|
|
2
2
|
require 'model_tests_helper'
|
|
3
3
|
|
|
4
|
+
class Validatable < User
|
|
5
|
+
devise :validatable, password_length: 10..20
|
|
6
|
+
end
|
|
7
|
+
|
|
4
8
|
class InvitableTest < ActiveSupport::TestCase
|
|
5
9
|
|
|
6
10
|
def setup
|
|
@@ -85,12 +89,12 @@ class InvitableTest < ActiveSupport::TestCase
|
|
|
85
89
|
user.invite!
|
|
86
90
|
old_invitation_created_at = 3.days.ago
|
|
87
91
|
old_invitation_sent_at = 3.days.ago
|
|
88
|
-
user.
|
|
92
|
+
user.update(invitation_sent_at: old_invitation_sent_at, invitation_created_at: old_invitation_created_at)
|
|
89
93
|
3.times do
|
|
90
94
|
user.invite!
|
|
91
95
|
refute_equal old_invitation_sent_at, user.invitation_sent_at
|
|
92
96
|
refute_equal old_invitation_created_at, user.invitation_created_at
|
|
93
|
-
user.
|
|
97
|
+
user.update(invitation_sent_at: old_invitation_sent_at, invitation_created_at: old_invitation_created_at)
|
|
94
98
|
end
|
|
95
99
|
end
|
|
96
100
|
|
|
@@ -367,10 +371,10 @@ class InvitableTest < ActiveSupport::TestCase
|
|
|
367
371
|
existing_user.save(validate: false)
|
|
368
372
|
user = User.invite!(email: 'valid@email.com')
|
|
369
373
|
assert_equal user, existing_user
|
|
370
|
-
assert_equal [
|
|
374
|
+
assert_equal [{error: :taken}], user.errors.details[:email]
|
|
371
375
|
same_user = User.invite!(email: 'valid@email.com')
|
|
372
376
|
assert_equal same_user, existing_user
|
|
373
|
-
assert_equal [
|
|
377
|
+
assert_equal [{error: :taken}], same_user.errors.details[:email]
|
|
374
378
|
end
|
|
375
379
|
|
|
376
380
|
test 'should return a record with errors if user with pending invitation was found by e-mail' do
|
|
@@ -384,7 +388,7 @@ class InvitableTest < ActiveSupport::TestCase
|
|
|
384
388
|
|
|
385
389
|
user = User.invite!(email: 'valid@email.com')
|
|
386
390
|
assert_equal user, existing_user
|
|
387
|
-
assert_equal [
|
|
391
|
+
assert_equal [{error: :taken}], user.errors.details[:email]
|
|
388
392
|
ensure
|
|
389
393
|
User.resend_invitation = resend_invitation
|
|
390
394
|
end
|
|
@@ -398,7 +402,7 @@ class InvitableTest < ActiveSupport::TestCase
|
|
|
398
402
|
existing_user.save(validate: false)
|
|
399
403
|
user = User.invite!(email: 'valid@email.com', username: 'a' * 50)
|
|
400
404
|
assert_equal user, existing_user
|
|
401
|
-
assert_equal [
|
|
405
|
+
assert_equal [{error: :taken}], user.errors.details[:email]
|
|
402
406
|
refute_empty user.errors[:username]
|
|
403
407
|
ensure
|
|
404
408
|
User.validate_on_invite = validate_on_invite
|
|
@@ -408,13 +412,13 @@ class InvitableTest < ActiveSupport::TestCase
|
|
|
408
412
|
test 'should return a new record with errors if e-mail is blank' do
|
|
409
413
|
invited_user = User.invite!(email: '')
|
|
410
414
|
assert invited_user.new_record?
|
|
411
|
-
assert_equal [
|
|
415
|
+
assert_equal [{error: :blank}], invited_user.errors.details[:email]
|
|
412
416
|
end
|
|
413
417
|
|
|
414
418
|
test 'should return a new record with errors if e-mail is invalid' do
|
|
415
419
|
invited_user = User.invite!(email: 'invalid_email')
|
|
416
420
|
assert invited_user.new_record?
|
|
417
|
-
assert_equal [
|
|
421
|
+
assert_equal [{error: :invalid}], invited_user.errors.details[:email]
|
|
418
422
|
end
|
|
419
423
|
|
|
420
424
|
test 'should set all attributes with errors if e-mail is invalid' do
|
|
@@ -434,13 +438,13 @@ class InvitableTest < ActiveSupport::TestCase
|
|
|
434
438
|
test 'should return a new record with errors if no invitation_token is found' do
|
|
435
439
|
invited_user = User.accept_invitation!(invitation_token: 'invalid_token')
|
|
436
440
|
assert invited_user.new_record?
|
|
437
|
-
assert_equal [
|
|
441
|
+
assert_equal [{error: :invalid}], invited_user.errors.details[:invitation_token]
|
|
438
442
|
end
|
|
439
443
|
|
|
440
444
|
test 'should return a new record with errors if invitation_token is blank' do
|
|
441
445
|
invited_user = User.accept_invitation!(invitation_token: '')
|
|
442
446
|
assert invited_user.new_record?
|
|
443
|
-
assert_equal [
|
|
447
|
+
assert_equal [{error: :blank}], invited_user.errors.details[:invitation_token]
|
|
444
448
|
end
|
|
445
449
|
|
|
446
450
|
test 'should return record with errors if invitation_token has expired' do
|
|
@@ -450,7 +454,7 @@ class InvitableTest < ActiveSupport::TestCase
|
|
|
450
454
|
invited_user.save(validate: false)
|
|
451
455
|
user = User.accept_invitation!(invitation_token: Thread.current[:token])
|
|
452
456
|
assert_equal user, invited_user
|
|
453
|
-
assert_equal [
|
|
457
|
+
assert_equal [{error: :invalid}], user.errors.details[:invitation_token]
|
|
454
458
|
end
|
|
455
459
|
|
|
456
460
|
test 'should allow record modification using block' do
|
|
@@ -760,4 +764,16 @@ class InvitableTest < ActiveSupport::TestCase
|
|
|
760
764
|
assert user.persisted?
|
|
761
765
|
assert user.errors.empty?
|
|
762
766
|
end
|
|
767
|
+
|
|
768
|
+
test 'should set initial password following Devise.password_length' do
|
|
769
|
+
user = User.invite!(email: 'valid@email.com')
|
|
770
|
+
assert_empty user.errors
|
|
771
|
+
assert_equal Devise.password_length.last, user.password.length
|
|
772
|
+
end
|
|
773
|
+
|
|
774
|
+
test 'should set initial passsword using :validatable with custom password_length' do
|
|
775
|
+
user = Validatable.invite!(email: 'valid@email.com')
|
|
776
|
+
assert_empty user.errors
|
|
777
|
+
assert_equal Validatable.password_length.last, user.password.length
|
|
778
|
+
end
|
|
763
779
|
end
|
data/test/orm/active_record.rb
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
ActiveRecord::Migration.verbose = false
|
|
2
2
|
ActiveRecord::Base.logger = Logger.new(nil)
|
|
3
3
|
|
|
4
|
-
if
|
|
4
|
+
if ActiveRecord::VERSION::MAJOR >= 6
|
|
5
|
+
ActiveRecord::MigrationContext.new(
|
|
6
|
+
File.expand_path('../../rails_app/db/migrate/', __FILE__),
|
|
7
|
+
ActiveRecord::Base.connection.schema_migration
|
|
8
|
+
).migrate
|
|
9
|
+
elsif defined? ActiveRecord::MigrationContext # rails >= 5.2
|
|
5
10
|
ActiveRecord::MigrationContext.new(File.expand_path('../../rails_app/db/migrate/', __FILE__)).migrate
|
|
6
11
|
else
|
|
7
12
|
ActiveRecord::Migrator.migrate(File.expand_path('../../rails_app/db/migrate/', __FILE__))
|
|
@@ -3,15 +3,16 @@ class ApplicationController < ActionController::Base
|
|
|
3
3
|
before_action :configure_permitted_parameters, if: :devise_controller?
|
|
4
4
|
|
|
5
5
|
protected
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
|
|
7
|
+
def after_sign_in_path_for(resource)
|
|
8
|
+
if resource.is_a? Admin
|
|
9
|
+
edit_admin_registration_path(resource)
|
|
10
|
+
else
|
|
11
|
+
super
|
|
12
|
+
end
|
|
11
13
|
end
|
|
12
|
-
end
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
def configure_permitted_parameters
|
|
16
|
+
devise_parameter_sanitizer.permit(:sign_up, keys: [:email, :password, :bio])
|
|
17
|
+
end
|
|
17
18
|
end
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
class FreeInvitationsController < Devise::InvitationsController
|
|
2
2
|
protected
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
|
|
4
|
+
def authenticate_inviter!
|
|
5
|
+
# everyone can invite
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def current_inviter
|
|
9
|
+
current_admin || current_user
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def after_invite_path_for(resource)
|
|
13
|
+
resource ? super : root_path
|
|
14
|
+
end
|
|
12
15
|
end
|
|
@@ -91,8 +91,8 @@ Devise.setup do |config|
|
|
|
91
91
|
# config.pepper = "e31589192aeea8807cb7d8686b0f8484d6cbfaaa65443d45144519ed1d4ffbc6ccb73b21a69ece276d94f2cac95d83990d824f36f301d6f585ededd1bf90d67d"
|
|
92
92
|
|
|
93
93
|
# ==> Configuration for :invitable
|
|
94
|
-
# The period the generated invitation token is valid
|
|
95
|
-
# this period, the invited resource won't be able to accept the invitation.
|
|
94
|
+
# The period the generated invitation token is valid.
|
|
95
|
+
# After this period, the invited resource won't be able to accept the invitation.
|
|
96
96
|
# When invite_for is 0 (the default), the invitation won't expire.
|
|
97
97
|
# config.invite_for = 2.weeks
|
|
98
98
|
|
|
@@ -111,7 +111,8 @@ Devise.setup do |config|
|
|
|
111
111
|
# config.invite_key = {:email => /\\A[^@]+@[^@]+\\z/}
|
|
112
112
|
# config.invite_key = {:email => /\\A[^@]+@[^@]+\\z/, :username => nil}
|
|
113
113
|
|
|
114
|
-
#
|
|
114
|
+
# Ensure that invited record is valid.
|
|
115
|
+
# The invitation won't be sent if this check fails.
|
|
115
116
|
# Default: false
|
|
116
117
|
# config.validate_on_invite = true
|
|
117
118
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
|
7
|
+
if Rails.version < '5.2.0'
|
|
8
|
+
RailsApp::Application.config.secret_token = 'e997edf9d7eba5cf89a76a046fa53f5d66261d22cfcf29e3f538c75ad2d175b106bd5d099f44f6ce34ad3b3162d71cfaa37d2d4f4b38645288331427b4c2a607'
|
|
9
|
+
end
|
|
@@ -32,7 +32,6 @@ class CreateTables < (Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRe
|
|
|
32
32
|
t.timestamps :null => false
|
|
33
33
|
end
|
|
34
34
|
add_index :users, :invitation_token, :unique => true
|
|
35
|
-
add_index :users, :invitations_count
|
|
36
35
|
|
|
37
36
|
create_table :admins do |t|
|
|
38
37
|
## Database authenticatable
|
|
@@ -41,6 +40,5 @@ class CreateTables < (Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRe
|
|
|
41
40
|
|
|
42
41
|
t.integer :invitations_count, :default => 0
|
|
43
42
|
end
|
|
44
|
-
add_index :admins, :invitations_count
|
|
45
43
|
end
|
|
46
44
|
end
|
data/test/test_helper.rb
CHANGED
|
@@ -7,11 +7,11 @@ require "rails_app/config/environment"
|
|
|
7
7
|
require 'rails/test_help'
|
|
8
8
|
require "orm/#{DEVISE_ORM}"
|
|
9
9
|
require 'capybara/rails'
|
|
10
|
-
require 'mocha/
|
|
10
|
+
require 'mocha/minitest'
|
|
11
11
|
|
|
12
12
|
ActionMailer::Base.delivery_method = :test
|
|
13
13
|
ActionMailer::Base.perform_deliveries = true
|
|
14
|
-
ActionMailer::Base.default_url_options[:host] = '
|
|
14
|
+
ActionMailer::Base.default_url_options[:host] = 'example.com'
|
|
15
15
|
|
|
16
16
|
ActiveSupport::Deprecation.silenced = true
|
|
17
17
|
$VERBOSE = false
|
|
@@ -19,28 +19,15 @@ $VERBOSE = false
|
|
|
19
19
|
class ActionDispatch::IntegrationTest
|
|
20
20
|
include Capybara::DSL
|
|
21
21
|
end
|
|
22
|
+
|
|
22
23
|
class ActionController::TestCase
|
|
23
24
|
if defined? Devise::Test
|
|
24
25
|
include Devise::Test::ControllerHelpers
|
|
25
26
|
else
|
|
26
27
|
include Devise::TestHelpers
|
|
27
28
|
end
|
|
29
|
+
|
|
28
30
|
if defined? ActiveRecord
|
|
29
|
-
|
|
30
|
-
self.use_transactional_tests = true
|
|
31
|
-
else
|
|
32
|
-
begin
|
|
33
|
-
require 'test_after_commit'
|
|
34
|
-
self.use_transactional_fixtures = true
|
|
35
|
-
rescue LoadError
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
if Rails.version < '5.0.0'
|
|
41
|
-
def post(action, *args)
|
|
42
|
-
hash = args[0] || {}
|
|
43
|
-
super action, hash[:params], hash[:session], hash[:flash]
|
|
44
|
-
end
|
|
31
|
+
self.use_transactional_tests = true
|
|
45
32
|
end
|
|
46
33
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sergio Cambra
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-04-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: actionmailer
|
|
@@ -44,14 +44,14 @@ dependencies:
|
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 2.0
|
|
47
|
+
version: '2.0'
|
|
48
48
|
type: :development
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: 2.0
|
|
54
|
+
version: '2.0'
|
|
55
55
|
description: It adds support for send invitations by email (it requires to be authenticated)
|
|
56
56
|
and accept the invitation by setting a password.
|
|
57
57
|
email:
|
|
@@ -69,7 +69,29 @@ files:
|
|
|
69
69
|
- app/views/devise/invitations/new.html.erb
|
|
70
70
|
- app/views/devise/mailer/invitation_instructions.html.erb
|
|
71
71
|
- app/views/devise/mailer/invitation_instructions.text.erb
|
|
72
|
+
- config/locales/ar.yml
|
|
73
|
+
- config/locales/ca.yml
|
|
74
|
+
- config/locales/da.yml
|
|
75
|
+
- config/locales/de.yml
|
|
72
76
|
- config/locales/en.yml
|
|
77
|
+
- config/locales/es.yml
|
|
78
|
+
- config/locales/et.yml
|
|
79
|
+
- config/locales/fa.yml
|
|
80
|
+
- config/locales/fr.yml
|
|
81
|
+
- config/locales/it.yml
|
|
82
|
+
- config/locales/ja.yml
|
|
83
|
+
- config/locales/ko.yml
|
|
84
|
+
- config/locales/nl.yml
|
|
85
|
+
- config/locales/no.yml
|
|
86
|
+
- config/locales/pl.yml
|
|
87
|
+
- config/locales/pt-BR.yml
|
|
88
|
+
- config/locales/pt.yml
|
|
89
|
+
- config/locales/ru.yml
|
|
90
|
+
- config/locales/tr.yml
|
|
91
|
+
- config/locales/ua.yml
|
|
92
|
+
- config/locales/vi.yml
|
|
93
|
+
- config/locales/zh-HK.yml
|
|
94
|
+
- config/locales/zh-TW.yml
|
|
73
95
|
- lib/devise_invitable.rb
|
|
74
96
|
- lib/devise_invitable/controllers/helpers.rb
|
|
75
97
|
- lib/devise_invitable/inviter.rb
|
|
@@ -131,6 +153,7 @@ files:
|
|
|
131
153
|
- test/rails_app/config/initializers/devise.rb
|
|
132
154
|
- test/rails_app/config/initializers/inflections.rb
|
|
133
155
|
- test/rails_app/config/initializers/mime_types.rb
|
|
156
|
+
- test/rails_app/config/initializers/secret_token.rb
|
|
134
157
|
- test/rails_app/config/initializers/session_store.rb
|
|
135
158
|
- test/rails_app/config/initializers/wrap_parameters.rb
|
|
136
159
|
- test/rails_app/config/locales/devise.en.yml
|
|
@@ -146,7 +169,7 @@ homepage: https://github.com/scambra/devise_invitable
|
|
|
146
169
|
licenses:
|
|
147
170
|
- MIT
|
|
148
171
|
metadata: {}
|
|
149
|
-
post_install_message:
|
|
172
|
+
post_install_message:
|
|
150
173
|
rdoc_options:
|
|
151
174
|
- "--main"
|
|
152
175
|
- README.rdoc
|
|
@@ -164,9 +187,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
164
187
|
- !ruby/object:Gem::Version
|
|
165
188
|
version: '0'
|
|
166
189
|
requirements: []
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
signing_key:
|
|
190
|
+
rubygems_version: 3.3.7
|
|
191
|
+
signing_key:
|
|
170
192
|
specification_version: 4
|
|
171
193
|
summary: An invitation strategy for Devise
|
|
172
194
|
test_files:
|
|
@@ -212,6 +234,7 @@ test_files:
|
|
|
212
234
|
- test/rails_app/config/initializers/devise.rb
|
|
213
235
|
- test/rails_app/config/initializers/inflections.rb
|
|
214
236
|
- test/rails_app/config/initializers/mime_types.rb
|
|
237
|
+
- test/rails_app/config/initializers/secret_token.rb
|
|
215
238
|
- test/rails_app/config/initializers/session_store.rb
|
|
216
239
|
- test/rails_app/config/initializers/wrap_parameters.rb
|
|
217
240
|
- test/rails_app/config/locales/devise.en.yml
|