devise 4.4.3 → 4.9.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +174 -4
  3. data/MIT-LICENSE +2 -1
  4. data/README.md +129 -65
  5. data/app/controllers/devise/confirmations_controller.rb +1 -0
  6. data/app/controllers/devise/passwords_controller.rb +3 -2
  7. data/app/controllers/devise/registrations_controller.rb +27 -9
  8. data/app/controllers/devise/sessions_controller.rb +2 -2
  9. data/app/controllers/devise/unlocks_controller.rb +1 -0
  10. data/app/controllers/devise_controller.rb +17 -3
  11. data/app/helpers/devise_helper.rb +21 -18
  12. data/app/mailers/devise/mailer.rb +5 -5
  13. data/app/views/devise/confirmations/new.html.erb +1 -1
  14. data/app/views/devise/passwords/edit.html.erb +3 -3
  15. data/app/views/devise/passwords/new.html.erb +1 -1
  16. data/app/views/devise/registrations/edit.html.erb +5 -5
  17. data/app/views/devise/registrations/new.html.erb +3 -3
  18. data/app/views/devise/sessions/new.html.erb +3 -3
  19. data/app/views/devise/shared/_error_messages.html.erb +15 -0
  20. data/app/views/devise/shared/_links.html.erb +8 -8
  21. data/app/views/devise/unlocks/new.html.erb +1 -1
  22. data/config/locales/en.yml +3 -2
  23. data/lib/devise/controllers/helpers.rb +10 -8
  24. data/lib/devise/controllers/responder.rb +35 -0
  25. data/lib/devise/controllers/sign_in_out.rb +9 -4
  26. data/lib/devise/controllers/url_helpers.rb +1 -1
  27. data/lib/devise/failure_app.rb +41 -8
  28. data/lib/devise/hooks/csrf_cleaner.rb +6 -1
  29. data/lib/devise/hooks/lockable.rb +2 -5
  30. data/lib/devise/hooks/timeoutable.rb +2 -2
  31. data/lib/devise/mapping.rb +1 -1
  32. data/lib/devise/models/authenticatable.rb +51 -48
  33. data/lib/devise/models/confirmable.rb +34 -40
  34. data/lib/devise/models/database_authenticatable.rb +54 -35
  35. data/lib/devise/models/lockable.rb +13 -5
  36. data/lib/devise/models/omniauthable.rb +2 -2
  37. data/lib/devise/models/recoverable.rb +8 -19
  38. data/lib/devise/models/registerable.rb +2 -0
  39. data/lib/devise/models/rememberable.rb +2 -2
  40. data/lib/devise/models/timeoutable.rb +1 -1
  41. data/lib/devise/models/trackable.rb +9 -2
  42. data/lib/devise/models/validatable.rb +4 -9
  43. data/lib/devise/models.rb +1 -0
  44. data/lib/devise/omniauth.rb +2 -5
  45. data/lib/devise/orm.rb +71 -0
  46. data/lib/devise/parameter_filter.rb +2 -0
  47. data/lib/devise/parameter_sanitizer.rb +13 -1
  48. data/lib/devise/rails/deprecated_constant_accessor.rb +39 -0
  49. data/lib/devise/rails/routes.rb +6 -6
  50. data/lib/devise/rails.rb +4 -0
  51. data/lib/devise/secret_key_finder.rb +2 -0
  52. data/lib/devise/strategies/authenticatable.rb +1 -1
  53. data/lib/devise/strategies/database_authenticatable.rb +6 -1
  54. data/lib/devise/test/controller_helpers.rb +5 -3
  55. data/lib/devise/test/integration_helpers.rb +1 -1
  56. data/lib/devise/test_helpers.rb +1 -1
  57. data/lib/devise/version.rb +1 -1
  58. data/lib/devise.rb +38 -11
  59. data/lib/generators/active_record/devise_generator.rb +26 -11
  60. data/lib/generators/devise/controllers_generator.rb +1 -1
  61. data/lib/generators/devise/devise_generator.rb +1 -1
  62. data/lib/generators/devise/install_generator.rb +1 -5
  63. data/lib/generators/devise/orm_helpers.rb +2 -2
  64. data/lib/generators/devise/views_generator.rb +1 -1
  65. data/lib/generators/mongoid/devise_generator.rb +5 -5
  66. data/lib/generators/templates/README +9 -1
  67. data/lib/generators/templates/controllers/omniauth_callbacks_controller.rb +1 -1
  68. data/lib/generators/templates/devise.rb +38 -8
  69. data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +5 -1
  70. data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +10 -2
  71. data/lib/generators/templates/simple_form_for/passwords/new.html.erb +4 -1
  72. data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +12 -4
  73. data/lib/generators/templates/simple_form_for/registrations/new.html.erb +11 -3
  74. data/lib/generators/templates/simple_form_for/sessions/new.html.erb +7 -2
  75. data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +4 -1
  76. metadata +23 -316
  77. data/.gitignore +0 -10
  78. data/.travis.yml +0 -68
  79. data/.yardopts +0 -9
  80. data/CODE_OF_CONDUCT.md +0 -22
  81. data/CONTRIBUTING.md +0 -79
  82. data/Gemfile +0 -39
  83. data/Gemfile.lock +0 -193
  84. data/ISSUE_TEMPLATE.md +0 -19
  85. data/Rakefile +0 -37
  86. data/bin/test +0 -13
  87. data/devise.gemspec +0 -28
  88. data/devise.png +0 -0
  89. data/gemfiles/Gemfile.rails-4.1-stable +0 -32
  90. data/gemfiles/Gemfile.rails-4.1-stable.lock +0 -171
  91. data/gemfiles/Gemfile.rails-4.2-stable +0 -32
  92. data/gemfiles/Gemfile.rails-4.2-stable.lock +0 -192
  93. data/gemfiles/Gemfile.rails-5.0-stable +0 -33
  94. data/gemfiles/Gemfile.rails-5.0-stable.lock +0 -192
  95. data/gemfiles/Gemfile.rails-5.2-rc1 +0 -26
  96. data/gemfiles/Gemfile.rails-5.2-rc1.lock +0 -201
  97. data/guides/bug_report_templates/integration_test.rb +0 -106
  98. data/test/controllers/custom_registrations_controller_test.rb +0 -42
  99. data/test/controllers/custom_strategy_test.rb +0 -66
  100. data/test/controllers/helper_methods_test.rb +0 -24
  101. data/test/controllers/helpers_test.rb +0 -318
  102. data/test/controllers/inherited_controller_i18n_messages_test.rb +0 -53
  103. data/test/controllers/internal_helpers_test.rb +0 -129
  104. data/test/controllers/load_hooks_controller_test.rb +0 -21
  105. data/test/controllers/passwords_controller_test.rb +0 -34
  106. data/test/controllers/sessions_controller_test.rb +0 -108
  107. data/test/controllers/url_helpers_test.rb +0 -67
  108. data/test/delegator_test.rb +0 -21
  109. data/test/devise_test.rb +0 -109
  110. data/test/failure_app_test.rb +0 -340
  111. data/test/generators/active_record_generator_test.rb +0 -130
  112. data/test/generators/controllers_generator_test.rb +0 -50
  113. data/test/generators/devise_generator_test.rb +0 -41
  114. data/test/generators/install_generator_test.rb +0 -26
  115. data/test/generators/mongoid_generator_test.rb +0 -25
  116. data/test/generators/views_generator_test.rb +0 -105
  117. data/test/helpers/devise_helper_test.rb +0 -51
  118. data/test/integration/authenticatable_test.rb +0 -706
  119. data/test/integration/confirmable_test.rb +0 -326
  120. data/test/integration/database_authenticatable_test.rb +0 -97
  121. data/test/integration/http_authenticatable_test.rb +0 -114
  122. data/test/integration/lockable_test.rb +0 -242
  123. data/test/integration/mounted_engine_test.rb +0 -38
  124. data/test/integration/omniauthable_test.rb +0 -148
  125. data/test/integration/recoverable_test.rb +0 -349
  126. data/test/integration/registerable_test.rb +0 -365
  127. data/test/integration/rememberable_test.rb +0 -219
  128. data/test/integration/timeoutable_test.rb +0 -186
  129. data/test/integration/trackable_test.rb +0 -99
  130. data/test/mailers/confirmation_instructions_test.rb +0 -117
  131. data/test/mailers/email_changed_test.rb +0 -132
  132. data/test/mailers/mailer_test.rb +0 -20
  133. data/test/mailers/reset_password_instructions_test.rb +0 -98
  134. data/test/mailers/unlock_instructions_test.rb +0 -93
  135. data/test/mapping_test.rb +0 -136
  136. data/test/models/authenticatable_test.rb +0 -25
  137. data/test/models/confirmable_test.rb +0 -549
  138. data/test/models/database_authenticatable_test.rb +0 -283
  139. data/test/models/lockable_test.rb +0 -352
  140. data/test/models/omniauthable_test.rb +0 -9
  141. data/test/models/recoverable_test.rb +0 -263
  142. data/test/models/registerable_test.rb +0 -9
  143. data/test/models/rememberable_test.rb +0 -184
  144. data/test/models/serializable_test.rb +0 -60
  145. data/test/models/timeoutable_test.rb +0 -53
  146. data/test/models/trackable_test.rb +0 -62
  147. data/test/models/validatable_test.rb +0 -121
  148. data/test/models_test.rb +0 -155
  149. data/test/omniauth/config_test.rb +0 -61
  150. data/test/omniauth/url_helpers_test.rb +0 -53
  151. data/test/orm/active_record.rb +0 -24
  152. data/test/orm/mongoid.rb +0 -15
  153. data/test/parameter_sanitizer_test.rb +0 -77
  154. data/test/rails_app/Rakefile +0 -6
  155. data/test/rails_app/app/active_record/admin.rb +0 -8
  156. data/test/rails_app/app/active_record/shim.rb +0 -4
  157. data/test/rails_app/app/active_record/user.rb +0 -20
  158. data/test/rails_app/app/active_record/user_on_engine.rb +0 -9
  159. data/test/rails_app/app/active_record/user_on_main_app.rb +0 -9
  160. data/test/rails_app/app/active_record/user_with_validations.rb +0 -12
  161. data/test/rails_app/app/active_record/user_without_email.rb +0 -10
  162. data/test/rails_app/app/controllers/admins/sessions_controller.rb +0 -8
  163. data/test/rails_app/app/controllers/admins_controller.rb +0 -8
  164. data/test/rails_app/app/controllers/application_controller.rb +0 -13
  165. data/test/rails_app/app/controllers/application_with_fake_engine.rb +0 -32
  166. data/test/rails_app/app/controllers/custom/registrations_controller.rb +0 -33
  167. data/test/rails_app/app/controllers/home_controller.rb +0 -31
  168. data/test/rails_app/app/controllers/publisher/registrations_controller.rb +0 -4
  169. data/test/rails_app/app/controllers/publisher/sessions_controller.rb +0 -4
  170. data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +0 -16
  171. data/test/rails_app/app/controllers/users_controller.rb +0 -33
  172. data/test/rails_app/app/helpers/application_helper.rb +0 -5
  173. data/test/rails_app/app/mailers/users/from_proc_mailer.rb +0 -5
  174. data/test/rails_app/app/mailers/users/mailer.rb +0 -5
  175. data/test/rails_app/app/mailers/users/reply_to_mailer.rb +0 -6
  176. data/test/rails_app/app/mongoid/admin.rb +0 -31
  177. data/test/rails_app/app/mongoid/shim.rb +0 -25
  178. data/test/rails_app/app/mongoid/user.rb +0 -50
  179. data/test/rails_app/app/mongoid/user_on_engine.rb +0 -41
  180. data/test/rails_app/app/mongoid/user_on_main_app.rb +0 -41
  181. data/test/rails_app/app/mongoid/user_with_validations.rb +0 -37
  182. data/test/rails_app/app/mongoid/user_without_email.rb +0 -35
  183. data/test/rails_app/app/views/admins/index.html.erb +0 -1
  184. data/test/rails_app/app/views/admins/sessions/new.html.erb +0 -2
  185. data/test/rails_app/app/views/home/admin_dashboard.html.erb +0 -1
  186. data/test/rails_app/app/views/home/index.html.erb +0 -1
  187. data/test/rails_app/app/views/home/join.html.erb +0 -1
  188. data/test/rails_app/app/views/home/private.html.erb +0 -1
  189. data/test/rails_app/app/views/home/user_dashboard.html.erb +0 -1
  190. data/test/rails_app/app/views/layouts/application.html.erb +0 -24
  191. data/test/rails_app/app/views/users/edit_form.html.erb +0 -1
  192. data/test/rails_app/app/views/users/index.html.erb +0 -1
  193. data/test/rails_app/app/views/users/mailer/confirmation_instructions.erb +0 -1
  194. data/test/rails_app/app/views/users/sessions/new.html.erb +0 -1
  195. data/test/rails_app/bin/bundle +0 -3
  196. data/test/rails_app/bin/rails +0 -4
  197. data/test/rails_app/bin/rake +0 -4
  198. data/test/rails_app/config/application.rb +0 -48
  199. data/test/rails_app/config/boot.rb +0 -27
  200. data/test/rails_app/config/database.yml +0 -18
  201. data/test/rails_app/config/environment.rb +0 -7
  202. data/test/rails_app/config/environments/development.rb +0 -32
  203. data/test/rails_app/config/environments/production.rb +0 -88
  204. data/test/rails_app/config/environments/test.rb +0 -47
  205. data/test/rails_app/config/initializers/backtrace_silencers.rb +0 -9
  206. data/test/rails_app/config/initializers/devise.rb +0 -182
  207. data/test/rails_app/config/initializers/inflections.rb +0 -4
  208. data/test/rails_app/config/initializers/secret_token.rb +0 -5
  209. data/test/rails_app/config/initializers/session_store.rb +0 -3
  210. data/test/rails_app/config/routes.rb +0 -128
  211. data/test/rails_app/config.ru +0 -4
  212. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +0 -77
  213. data/test/rails_app/db/schema.rb +0 -57
  214. data/test/rails_app/lib/shared_admin.rb +0 -23
  215. data/test/rails_app/lib/shared_user.rb +0 -32
  216. data/test/rails_app/lib/shared_user_without_email.rb +0 -28
  217. data/test/rails_app/lib/shared_user_without_omniauth.rb +0 -15
  218. data/test/rails_app/public/404.html +0 -26
  219. data/test/rails_app/public/422.html +0 -26
  220. data/test/rails_app/public/500.html +0 -26
  221. data/test/rails_app/public/favicon.ico +0 -0
  222. data/test/rails_test.rb +0 -11
  223. data/test/routes_test.rb +0 -281
  224. data/test/secret_key_finder_test.rb +0 -97
  225. data/test/support/action_controller/record_identifier.rb +0 -12
  226. data/test/support/assertions.rb +0 -30
  227. data/test/support/helpers.rb +0 -83
  228. data/test/support/http_method_compatibility.rb +0 -53
  229. data/test/support/integration.rb +0 -95
  230. data/test/support/locale/en.yml +0 -8
  231. data/test/support/mongoid.yml +0 -6
  232. data/test/support/webrat/integrations/rails.rb +0 -35
  233. data/test/test/controller_helpers_test.rb +0 -193
  234. data/test/test/integration_helpers_test.rb +0 -34
  235. data/test/test_helper.rb +0 -36
  236. data/test/test_models.rb +0 -35
@@ -1,93 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- class UnlockInstructionsTest < ActionMailer::TestCase
6
-
7
- def setup
8
- setup_mailer
9
- Devise.mailer = 'Devise::Mailer'
10
- Devise.mailer_sender = 'test@example.com'
11
- end
12
-
13
- def teardown
14
- Devise.mailer = 'Devise::Mailer'
15
- Devise.mailer_sender = 'please-change-me@config-initializers-devise.com'
16
- end
17
-
18
- def user
19
- @user ||= begin
20
- user = create_user
21
- user.lock_access!
22
- user
23
- end
24
- end
25
-
26
- def mail
27
- @mail ||= begin
28
- user
29
- ActionMailer::Base.deliveries.last
30
- end
31
- end
32
-
33
- test 'email sent after locking the user' do
34
- assert_not_nil mail
35
- end
36
-
37
- test 'content type should be set to html' do
38
- assert mail.content_type.include?('text/html')
39
- end
40
-
41
- test 'send unlock instructions to the user email' do
42
- assert_equal [user.email], mail.to
43
- end
44
-
45
- test 'set up sender from configuration' do
46
- assert_equal ['test@example.com'], mail.from
47
- end
48
-
49
- test 'set up sender from custom mailer defaults' do
50
- Devise.mailer = 'Users::Mailer'
51
- assert_equal ['custom@example.com'], mail.from
52
- end
53
-
54
- test 'set up sender from custom mailer defaults with proc' do
55
- Devise.mailer = 'Users::FromProcMailer'
56
- assert_equal ['custom@example.com'], mail.from
57
- end
58
-
59
- test 'custom mailer renders parent mailer template' do
60
- Devise.mailer = 'Users::Mailer'
61
- assert_present mail.body.encoded
62
- end
63
-
64
- test 'set up reply to as copy from sender' do
65
- assert_equal ['test@example.com'], mail.reply_to
66
- end
67
-
68
- test 'set up subject from I18n' do
69
- store_translations :en, devise: { mailer: { unlock_instructions: { subject: 'Yo unlock instructions' } } } do
70
- assert_equal 'Yo unlock instructions', mail.subject
71
- end
72
- end
73
-
74
- test 'subject namespaced by model' do
75
- store_translations :en, devise: { mailer: { unlock_instructions: { user_subject: 'User Unlock Instructions' } } } do
76
- assert_equal 'User Unlock Instructions', mail.subject
77
- end
78
- end
79
-
80
- test 'body should have user info' do
81
- assert_match user.email, mail.body.encoded
82
- end
83
-
84
- test 'body should have link to unlock the account' do
85
- host, port = ActionMailer::Base.default_url_options.values_at :host, :port
86
-
87
- if mail.body.encoded =~ %r{<a href=\"http://#{host}:#{port}/users/unlock\?unlock_token=([^"]+)">}
88
- assert_equal Devise.token_generator.digest(user.class, :unlock_token, $1), user.unlock_token
89
- else
90
- flunk "expected unlock url regex to match"
91
- end
92
- end
93
- end
data/test/mapping_test.rb DELETED
@@ -1,136 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- class FakeRequest < Struct.new(:path_info, :params)
6
- end
7
-
8
- class MappingTest < ActiveSupport::TestCase
9
- def fake_request(path, params={})
10
- FakeRequest.new(path, params)
11
- end
12
-
13
- test 'store options' do
14
- mapping = Devise.mappings[:user]
15
- assert_equal User, mapping.to
16
- assert_equal User.devise_modules, mapping.modules
17
- assert_equal "users", mapping.scoped_path
18
- assert_equal :user, mapping.singular
19
- assert_equal "users", mapping.path
20
- assert_equal "/users", mapping.fullpath
21
- end
22
-
23
- test 'store options with namespace' do
24
- mapping = Devise.mappings[:publisher_account]
25
- assert_equal Admin, mapping.to
26
- assert_equal "publisher/accounts", mapping.scoped_path
27
- assert_equal :publisher_account, mapping.singular
28
- assert_equal "accounts", mapping.path
29
- assert_equal "/publisher/accounts", mapping.fullpath
30
- end
31
-
32
- test 'allows path to be given' do
33
- assert_equal "admin_area", Devise.mappings[:admin].path
34
- end
35
-
36
- test 'allows to skip all routes' do
37
- assert_equal [], Devise.mappings[:skip_admin].used_routes
38
- end
39
-
40
- test 'sign_out_via defaults to :delete' do
41
- assert_equal :delete, Devise.mappings[:user].sign_out_via
42
- end
43
-
44
- test 'allows custom sign_out_via to be given' do
45
- assert_equal :delete, Devise.mappings[:sign_out_via_delete].sign_out_via
46
- assert_equal :post, Devise.mappings[:sign_out_via_post].sign_out_via
47
- assert_equal [:delete, :post], Devise.mappings[:sign_out_via_delete_or_post].sign_out_via
48
- end
49
-
50
- test 'allows custom singular to be given' do
51
- assert_equal "accounts", Devise.mappings[:manager].path
52
- end
53
-
54
- test 'has strategies depending on the model declaration' do
55
- assert_equal [:rememberable, :database_authenticatable], Devise.mappings[:user].strategies
56
- assert_equal [:database_authenticatable], Devise.mappings[:admin].strategies
57
- end
58
-
59
- test 'has no input strategies depending on the model declaration' do
60
- assert_equal [:rememberable], Devise.mappings[:user].no_input_strategies
61
- assert_equal [], Devise.mappings[:admin].no_input_strategies
62
- end
63
-
64
- test 'find scope for a given object' do
65
- assert_equal :user, Devise::Mapping.find_scope!(User)
66
- assert_equal :user, Devise::Mapping.find_scope!(:user)
67
- assert_equal :user, Devise::Mapping.find_scope!("user")
68
- assert_equal :user, Devise::Mapping.find_scope!(User.new)
69
- end
70
-
71
- test 'find scope works with single table inheritance' do
72
- assert_equal :user, Devise::Mapping.find_scope!(Class.new(User))
73
- assert_equal :user, Devise::Mapping.find_scope!(Class.new(User).new)
74
- end
75
-
76
- test 'find scope uses devise_scope' do
77
- user = User.new
78
- def user.devise_scope; :special_scope; end
79
- assert_equal :special_scope, Devise::Mapping.find_scope!(user)
80
- end
81
-
82
- test 'find scope raises an error if cannot be found' do
83
- assert_raise RuntimeError do
84
- Devise::Mapping.find_scope!(String)
85
- end
86
- end
87
-
88
- test 'return default path names' do
89
- mapping = Devise.mappings[:user]
90
- assert_equal 'sign_in', mapping.path_names[:sign_in]
91
- assert_equal 'sign_out', mapping.path_names[:sign_out]
92
- assert_equal 'password', mapping.path_names[:password]
93
- assert_equal 'confirmation', mapping.path_names[:confirmation]
94
- assert_equal 'sign_up', mapping.path_names[:sign_up]
95
- assert_equal 'unlock', mapping.path_names[:unlock]
96
- end
97
-
98
- test 'allow custom path names to be given' do
99
- mapping = Devise.mappings[:manager]
100
- assert_equal 'login', mapping.path_names[:sign_in]
101
- assert_equal 'logout', mapping.path_names[:sign_out]
102
- assert_equal 'secret', mapping.path_names[:password]
103
- assert_equal 'verification', mapping.path_names[:confirmation]
104
- assert_equal 'register', mapping.path_names[:sign_up]
105
- assert_equal 'unblock', mapping.path_names[:unlock]
106
- end
107
-
108
- test 'magic predicates' do
109
- mapping = Devise.mappings[:user]
110
- assert mapping.authenticatable?
111
- assert mapping.confirmable?
112
- assert mapping.recoverable?
113
- assert mapping.rememberable?
114
- assert mapping.registerable?
115
-
116
- mapping = Devise.mappings[:admin]
117
- assert mapping.authenticatable?
118
- assert mapping.recoverable?
119
- assert mapping.lockable?
120
- refute mapping.omniauthable?
121
- end
122
-
123
- test 'find mapping by path' do
124
- assert_raise RuntimeError do
125
- Devise::Mapping.find_by_path!('/accounts/facebook/callback')
126
- end
127
-
128
- assert_nothing_raised do
129
- Devise::Mapping.find_by_path!('/:locale/accounts/login')
130
- end
131
-
132
- assert_nothing_raised do
133
- Devise::Mapping.find_by_path!('/accounts/facebook/callback', :path)
134
- end
135
- end
136
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- class AuthenticatableTest < ActiveSupport::TestCase
6
- test 'required_fields should be an empty array' do
7
- assert_equal Devise::Models::Validatable.required_fields(User), []
8
- end
9
-
10
- test 'find_first_by_auth_conditions allows custom filtering parameters' do
11
- user = User.create!(email: "example@example.com", password: "1234567")
12
- assert_equal User.find_first_by_auth_conditions({ email: "example@example.com" }), user
13
- assert_nil User.find_first_by_auth_conditions({ email: "example@example.com" }, id: user.id.to_s.next)
14
- end
15
-
16
- if defined?(ActionController::Parameters)
17
- test 'does not passes an ActionController::Parameters to find_first_by_auth_conditions through find_or_initialize_with_errors' do
18
- user = create_user(email: 'example@example.com')
19
- attributes = ActionController::Parameters.new(email: 'example@example.com')
20
-
21
- User.expects(:find_first_by_auth_conditions).with('email' => 'example@example.com').returns(user)
22
- User.find_or_initialize_with_errors([:email], attributes)
23
- end
24
- end
25
- end