devise_invitable 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of devise_invitable might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2723ccf2ae328662f6728a699ac484ff5067dbb24248e59d7d596a9d445747ab
4
- data.tar.gz: 7d95b8d919685e863dbe8126ce5823b78f949c67f6ada3e69adab431d29e7711
3
+ metadata.gz: 60a516052fe7d7f32929e0d35df374e05405951924011c1e7922c046fd8f8f73
4
+ data.tar.gz: 4b790b2133f56ecd6dc5ac1736976bc1a689478e2094f093cfcb4ea2d19e1a39
5
5
  SHA512:
6
- metadata.gz: ba422fbe6c9b3d7d13dae30f24daf9638ace499ceead90f7d3d18949655028b33d53c5275000aafecd4a9b75595ad174d3348a4511a7dbe70957bd9a43cd5945
7
- data.tar.gz: b8eb68401a1fd5e41b861fbe8d8dd38b4f9050d87427d00cb5ea394630e5e5f5a16d6889da85199e597d8bdc2947aa8523208aca95fb731d39c50ba9f5d4a4d5
6
+ metadata.gz: 5fa8ed65bcf5ae7647aa798e9f63bbe20d19e0d87e28e1f0dc44f04dcc406e16980ffaa09cf94bb66ac6219c0d4d29829bafdd4fd3cdd86c2b628647ff05e14d
7
+ data.tar.gz: 9fcff0bb96a9c6f81345c772b48ecace9bb446583328ac942d521c292533dae8132078a3593d30419c48abae381a8c87a4519e97d73dca2a76bfb15702334af8
@@ -1,3 +1,6 @@
1
+ ## 2.0.1
2
+ - Use per-model allow_insecure_sign_in_after_accept ([#790](https://github.com/scambra/devise_invitable/pull/790))
3
+
1
4
  ## 2.0.0
2
5
  - Remove deprecated devise_error_messages! from templates ([#786](https://github.com/scambra/devise_invitable/pull/785))
3
6
  - Drop Devise < 4.6 support ([#786](https://github.com/scambra/devise_invitable/pull/786))
@@ -70,11 +70,6 @@ or for a model that already exists, define a migration to add DeviseInvitable to
70
70
  add_column :users, :invited_by_id, :integer
71
71
  add_column :users, :invited_by_type, :string
72
72
  add_index :users, :invitation_token, unique: true
73
-
74
- # Allow null encrypted_password
75
- change_column_null :users, :encrypted_password, :string, true
76
- # Allow null password_salt (add it if you are using Devise's encryptable module)
77
- change_column_null :users, :password_salt, :string, true
78
73
  end
79
74
 
80
75
  If you previously used devise_invitable with a <tt>:limit</tt> on <tt>:invitation_token</tt>, remove it:
@@ -109,13 +104,13 @@ Remember to create indexes within the MongoDB database after deploying your chan
109
104
 
110
105
  DeviseInvitable adds some new configuration options:
111
106
 
112
- * <tt>invite_for</tt>: The period the generated invitation token is valid, after this period, the invited resource won't be able to accept the invitation. When <tt>invite_for</tt> is <tt>0</tt> (the default), the invitation won't expire.
107
+ * <tt>invite_for</tt>: The period the generated invitation token is valid. After this period, the invited resource won't be able to accept the invitation. When <tt>invite_for</tt> is <tt>0</tt> (the default), the invitation won't expire.
113
108
 
114
109
  You can set this configuration option in the Devise initializer as follow:
115
110
 
116
111
  # ==> Configuration for :invitable
117
- # The period the generated invitation token is valid, after
118
- # this period, the invited resource won't be able to accept the invitation.
112
+ # The period the generated invitation token is valid.
113
+ # After this period, the invited resource won't be able to accept the invitation.
119
114
  # When invite_for is 0 (the default), the invitation won't expire.
120
115
  # config.invite_for = 2.weeks
121
116
 
@@ -186,23 +181,21 @@ To change behaviour of inviting or accepting users, you can simply override two
186
181
  class Users::InvitationsController < Devise::InvitationsController
187
182
  private
188
183
 
189
- # this is called when creating invitation
190
- # should return an instance of resource class
191
- def invite_resource
192
- ## skip sending emails on invite
193
- super do |u|
194
- u.skip_invitation = true
184
+ # this is called when creating invitation
185
+ # should return an instance of resource class
186
+ def invite_resource
187
+ # skip sending emails on invite
188
+ super { |user| user.skip_invitation = true }
195
189
  end
196
- end
197
190
 
198
- # this is called when accepting invitation
199
- # should return an instance of resource class
200
- def accept_resource
201
- resource = resource_class.accept_invitation!(update_resource_params)
202
- ## Report accepting invitation to analytics
203
- Analytics.report('invite.accept', resource.id)
204
- resource
205
- end
191
+ # this is called when accepting invitation
192
+ # should return an instance of resource class
193
+ def accept_resource
194
+ resource = resource_class.accept_invitation!(update_resource_params)
195
+ # Report accepting invitation to analytics
196
+ Analytics.report('invite.accept', resource.id)
197
+ resource
198
+ end
206
199
  end
207
200
 
208
201
  == Strong Parameters
@@ -242,12 +235,12 @@ If you want to create the invitation but not send it, you can set <tt>skip_invit
242
235
  # => the record will be created, but the invitation email will not be sent
243
236
 
244
237
  When generating the <tt>accept_user_invitation_url</tt> yourself, you must use the <tt>raw_invitation_token</tt>
245
- the value is temporarily available when you invite a user and will be decrypted when recieved.
238
+ the value is temporarily available when you invite a user and will be decrypted when received.
246
239
 
247
240
  accept_user_invitation_url(invitation_token: user.raw_invitation_token)
248
241
 
249
242
  When <tt>skip_invitation</tt> is used, you must also then set the <tt>invitation_sent_at</tt> field when the user is sent their token. Failure to do so will yield "Invalid invitation token" error when the user attempts to accept the invite.
250
- You can set column, or call <tt>deliver_invitation</tt> to sent invitation and set column:
243
+ You can set the column, or call <tt>deliver_invitation</tt> to send the invitation and set the column:
251
244
 
252
245
  user.deliver_invitation
253
246
 
@@ -335,10 +328,11 @@ Default behavior requires authentication of the same resource as the invited one
335
328
  You would have a <tt>User</tt> model which is configured as invitable and an <tt>Admin</tt> model which is not. If you want to allow only admins to send invitations, simply overwrite the <tt>authenticate_inviter!</tt> method as follow:
336
329
 
337
330
  class ApplicationController < ActionController::Base
338
- protected
339
- def authenticate_inviter!
340
- authenticate_admin!(force: true)
341
- end
331
+ protected
332
+
333
+ def authenticate_inviter!
334
+ authenticate_admin!(force: true)
335
+ end
342
336
  end
343
337
 
344
338
  And include <tt>DeviseInvitable::Inviter</tt> module into <tt>Admin</tt> model:
@@ -51,7 +51,7 @@ class Devise::InvitationsController < DeviseController
51
51
  yield resource if block_given?
52
52
 
53
53
  if invitation_accepted
54
- if Devise.allow_insecure_sign_in_after_accept
54
+ if resource.class.allow_insecure_sign_in_after_accept
55
55
  flash_message = resource.active_for_authentication? ? :updated : :updated_not_active
56
56
  set_flash_message :notice, flash_message if is_flashing_format?
57
57
  sign_in(resource_name, resource)
@@ -75,42 +75,42 @@ class Devise::InvitationsController < DeviseController
75
75
 
76
76
  protected
77
77
 
78
- def invite_resource(&block)
79
- resource_class.invite!(invite_params, current_inviter, &block)
80
- end
78
+ def invite_resource(&block)
79
+ resource_class.invite!(invite_params, current_inviter, &block)
80
+ end
81
81
 
82
- def accept_resource
83
- resource_class.accept_invitation!(update_resource_params)
84
- end
82
+ def accept_resource
83
+ resource_class.accept_invitation!(update_resource_params)
84
+ end
85
85
 
86
- def current_inviter
87
- authenticate_inviter!
88
- end
86
+ def current_inviter
87
+ authenticate_inviter!
88
+ end
89
89
 
90
- def has_invitations_left?
91
- unless current_inviter.nil? || current_inviter.has_invitations_left?
92
- self.resource = resource_class.new
93
- set_flash_message :alert, :no_invitations_remaining if is_flashing_format?
94
- respond_with_navigational(resource) { render :new }
90
+ def has_invitations_left?
91
+ unless current_inviter.nil? || current_inviter.has_invitations_left?
92
+ self.resource = resource_class.new
93
+ set_flash_message :alert, :no_invitations_remaining if is_flashing_format?
94
+ respond_with_navigational(resource) { render :new }
95
+ end
95
96
  end
96
- end
97
97
 
98
- def resource_from_invitation_token
99
- unless params[:invitation_token] && self.resource = resource_class.find_by_invitation_token(params[:invitation_token], true)
100
- set_flash_message(:alert, :invitation_token_invalid) if is_flashing_format?
101
- redirect_to after_sign_out_path_for(resource_name)
98
+ def resource_from_invitation_token
99
+ unless params[:invitation_token] && self.resource = resource_class.find_by_invitation_token(params[:invitation_token], true)
100
+ set_flash_message(:alert, :invitation_token_invalid) if is_flashing_format?
101
+ redirect_to after_sign_out_path_for(resource_name)
102
+ end
102
103
  end
103
- end
104
104
 
105
- def invite_params
106
- devise_parameter_sanitizer.sanitize(:invite)
107
- end
105
+ def invite_params
106
+ devise_parameter_sanitizer.sanitize(:invite)
107
+ end
108
108
 
109
- def update_resource_params
110
- devise_parameter_sanitizer.sanitize(:accept_invitation)
111
- end
109
+ def update_resource_params
110
+ devise_parameter_sanitizer.sanitize(:accept_invitation)
111
+ end
112
112
 
113
- def translation_scope
114
- 'devise.invitations'
115
- end
113
+ def translation_scope
114
+ 'devise.invitations'
115
+ end
116
116
  end
@@ -1,17 +1,17 @@
1
1
  class DeviseInvitable::RegistrationsController < Devise::RegistrationsController
2
2
  protected
3
3
 
4
- def build_resource(hash = {})
5
- if hash[:email]
6
- self.resource = resource_class.where(email: hash[:email]).first
7
- if self.resource && self.resource.respond_to?(:invited_to_sign_up?) && self.resource.invited_to_sign_up?
8
- self.resource.attributes = hash
9
- self.resource.send_confirmation_instructions if self.resource.confirmation_required_for_invited?
10
- self.resource.accept_invitation
11
- else
12
- self.resource = nil
4
+ def build_resource(hash = {})
5
+ if hash[:email]
6
+ self.resource = resource_class.where(email: hash[:email]).first
7
+ if self.resource && self.resource.respond_to?(:invited_to_sign_up?) && self.resource.invited_to_sign_up?
8
+ self.resource.attributes = hash
9
+ self.resource.send_confirmation_instructions if self.resource.confirmation_required_for_invited?
10
+ self.resource.accept_invitation
11
+ else
12
+ self.resource = nil
13
+ end
13
14
  end
15
+ self.resource ||= super
14
16
  end
15
- self.resource ||= super
16
- end
17
17
  end
@@ -7,7 +7,7 @@
7
7
  <% if f.object.class.require_password_on_accepting %>
8
8
  <div class="field">
9
9
  <%= f.label :password %><br />
10
- <%= f.password_field :password %></p>
10
+ <%= f.password_field :password %>
11
11
  </div>
12
12
 
13
13
  <div class="field">
@@ -2,7 +2,7 @@
2
2
 
3
3
  <p><%= t("devise.mailer.invitation_instructions.someone_invited_you", url: root_url) %></p>
4
4
 
5
- <p><%= link_to t("devise.mailer.invitation_instructions.accept"), accept_invitation_url(@resource, :invitation_token => @token) %></p>
5
+ <p><%= link_to t("devise.mailer.invitation_instructions.accept"), accept_invitation_url(@resource, invitation_token: @token) %></p>
6
6
 
7
7
  <% if @resource.invitation_due_at %>
8
8
  <p><%= t("devise.mailer.invitation_instructions.accept_until", due_date: l(@resource.invitation_due_at, format: :'devise.mailer.invitation_instructions.accept_until_format')) %></p>
@@ -2,7 +2,7 @@
2
2
 
3
3
  <%= t("devise.mailer.invitation_instructions.someone_invited_you", url: root_url) %>
4
4
 
5
- <%= accept_invitation_url(@resource, :invitation_token => @token) %>
5
+ <%= accept_invitation_url(@resource, invitation_token: @token) %>
6
6
 
7
7
  <% if @resource.invitation_due_at %>
8
8
  <%= t("devise.mailer.invitation_instructions.accept_until", due_date: l(@resource.invitation_due_at, format: :'devise.mailer.invitation_instructions.accept_until_format')) %>
@@ -22,7 +22,8 @@ module Devise
22
22
  mattr_accessor :invite_for
23
23
  @@invite_for = 0
24
24
 
25
- # Public: Flag that force a record to be valid before being actually invited
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)
@@ -14,9 +14,8 @@ module DeviseInvitable::Controllers::Helpers
14
14
 
15
15
  protected
16
16
 
17
- def authenticate_inviter!
18
- send(:"authenticate_#{resource_name}!", force: true)
19
- end
20
-
17
+ def authenticate_inviter!
18
+ send(:"authenticate_#{resource_name}!", force: true)
19
+ end
21
20
  end
22
21
 
@@ -25,6 +25,7 @@ module DeviseInvitable
25
25
  end
26
26
 
27
27
  protected
28
+
28
29
  def decrement_invitation_limit!
29
30
  if self.class.invitation_limit.present?
30
31
  self.invitation_limit ||= self.class.invitation_limit
@@ -32,8 +33,8 @@ module DeviseInvitable
32
33
  end
33
34
  end
34
35
 
35
- module ClassMethods
36
- Devise::Models.config(self, :invitation_limit)
37
- end
36
+ module ClassMethods
37
+ Devise::Models.config(self, :invitation_limit)
38
+ end
38
39
  end
39
40
  end
@@ -1,10 +1,11 @@
1
1
  module DeviseInvitable
2
2
  module Mapping
3
3
  private
4
- def default_controllers(options)
5
- options[:controllers] ||= {}
6
- options[:controllers][:registrations] ||= 'devise_invitable/registrations'
7
- super
8
- end
4
+
5
+ def default_controllers(options)
6
+ options[:controllers] ||= {}
7
+ options[:controllers][:registrations] ||= 'devise_invitable/registrations'
8
+ super
9
+ end
9
10
  end
10
11
  end
@@ -10,8 +10,8 @@ module Devise
10
10
  #
11
11
  # Configuration:
12
12
  #
13
- # invite_for: The period the generated invitation token is valid, after
14
- # this period, the invited resource won't be able to accept the invitation.
13
+ # invite_for: The period the generated invitation token is valid.
14
+ # After this period, the invited resource won't be able to accept the invitation.
15
15
  # When invite_for is 0 (the default), the invitation won't expire.
16
16
  #
17
17
  # Examples:
@@ -391,15 +391,14 @@ module Devise
391
391
 
392
392
  private
393
393
 
394
- # The random password, as set after an invitation, must conform
395
- # to any password format validation rules of the application.
396
- # This default fixes the most common scenarios: Passwords must contain
397
- # lower + upper case, a digit and a symbol.
398
- # For more unusual rules, this method can be overridden.
399
- def random_password
400
- 'aA1!' + Devise.friendly_token[0, 20]
401
- end
402
-
394
+ # The random password, as set after an invitation, must conform
395
+ # to any password format validation rules of the application.
396
+ # This default fixes the most common scenarios: Passwords must contain
397
+ # lower + upper case, a digit and a symbol.
398
+ # For more unusual rules, this method can be overridden.
399
+ def random_password
400
+ 'aA1!' + Devise.friendly_token[0, 20]
401
+ end
403
402
  end
404
403
  end
405
404
  end
@@ -12,27 +12,27 @@ module DeviseInvitable
12
12
 
13
13
  private
14
14
 
15
- if defined?(Devise::BaseSanitizer)
16
- def permit(keys)
17
- default_params.permit(*Array(keys))
18
- end
15
+ if defined?(Devise::BaseSanitizer)
16
+ def permit(keys)
17
+ default_params.permit(*Array(keys))
18
+ end
19
19
 
20
- def attributes_for(kind)
21
- case kind
22
- when :invite
23
- resource_class.respond_to?(:invite_key_fields) ? resource_class.invite_key_fields : []
24
- when :accept_invitation
25
- [:password, :password_confirmation, :invitation_token]
26
- else
20
+ def attributes_for(kind)
21
+ case kind
22
+ when :invite
23
+ resource_class.respond_to?(:invite_key_fields) ? resource_class.invite_key_fields : []
24
+ when :accept_invitation
25
+ [:password, :password_confirmation, :invitation_token]
26
+ else
27
+ super
28
+ end
29
+ end
30
+ else
31
+ def initialize(resource_class, resource_name, params)
27
32
  super
33
+ permit(:invite, keys: (resource_class.respond_to?(:invite_key_fields) ? resource_class.invite_key_fields : []) )
34
+ permit(:accept_invitation, keys: [:password, :password_confirmation, :invitation_token] )
28
35
  end
29
36
  end
30
- else
31
- def initialize(resource_class, resource_name, params)
32
- super
33
- permit(:invite, keys: (resource_class.respond_to?(:invite_key_fields) ? resource_class.invite_key_fields : []) )
34
- permit(:accept_invitation, keys: [:password, :password_confirmation, :invitation_token] )
35
- end
36
- end
37
37
  end
38
38
  end
@@ -2,6 +2,7 @@ module ActionDispatch::Routing
2
2
  class Mapper
3
3
 
4
4
  protected
5
+
5
6
  def devise_invitation(mapping, controllers)
6
7
  resource :invitation, only: [:new, :create, :update],
7
8
  path: mapping.path_names[:invitation], controller: controllers[:invitations] do
@@ -9,6 +10,5 @@ module ActionDispatch::Routing
9
10
  get :destroy, path: mapping.path_names[:remove], as: :remove
10
11
  end
11
12
  end
12
-
13
13
  end
14
14
  end
@@ -1,3 +1,3 @@
1
1
  module DeviseInvitable
2
- VERSION = '2.0.0'
2
+ VERSION = '2.0.1'.freeze
3
3
  end
@@ -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, after
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
- # Flag that force a record to be valid before being actually invited
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
 
@@ -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
- views.each do |path, files|
35
- files.each do |file|
36
- assert_file File.join path, file
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
@@ -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}"
@@ -1,6 +1,7 @@
1
1
  class AdminsController < Devise::InvitationsController
2
2
  protected
3
- def authenticate_inviter!
4
- authenticate_admin!(force: true)
5
- end
3
+
4
+ def authenticate_inviter!
5
+ authenticate_admin!(force: true)
6
+ end
6
7
  end
@@ -3,15 +3,16 @@ class ApplicationController < ActionController::Base
3
3
  before_action :configure_permitted_parameters, if: :devise_controller?
4
4
 
5
5
  protected
6
- def after_sign_in_path_for(resource)
7
- if resource.is_a? Admin
8
- edit_admin_registration_path(resource)
9
- else
10
- super
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
- def configure_permitted_parameters
15
- devise_parameter_sanitizer.permit(:sign_up, keys: [:email, :password, :bio])
16
- end
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
- def authenticate_inviter!
4
- # everyone can invite
5
- end
6
- def current_inviter
7
- current_admin || current_user
8
- end
9
- def after_invite_path_for(resource)
10
- resource ? super : root_path
11
- end
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, after
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
- # Flag that force a record to be valid before being actually invited
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
 
@@ -11,7 +11,7 @@ require 'mocha/setup'
11
11
 
12
12
  ActionMailer::Base.delivery_method = :test
13
13
  ActionMailer::Base.perform_deliveries = true
14
- ActionMailer::Base.default_url_options[:host] = 'test.com'
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
- if Rails.version >= '5.0.0'
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.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio Cambra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-25 00:00:00.000000000 Z
11
+ date: 2019-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer