devise 3.2.3 → 3.2.4

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

Potentially problematic release.


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

Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/Gemfile +2 -2
  4. data/Gemfile.lock +6 -6
  5. data/README.md +7 -0
  6. data/Rakefile +1 -1
  7. data/app/controllers/devise/confirmations_controller.rb +2 -2
  8. data/app/controllers/devise/omniauth_callbacks_controller.rb +2 -2
  9. data/app/controllers/devise/passwords_controller.rb +3 -3
  10. data/app/controllers/devise/registrations_controller.rb +7 -7
  11. data/app/controllers/devise/sessions_controller.rb +6 -6
  12. data/app/controllers/devise/unlocks_controller.rb +2 -2
  13. data/app/controllers/devise_controller.rb +3 -3
  14. data/app/helpers/devise_helper.rb +2 -2
  15. data/app/views/devise/confirmations/new.html.erb +2 -2
  16. data/app/views/devise/mailer/confirmation_instructions.html.erb +1 -1
  17. data/app/views/devise/mailer/reset_password_instructions.html.erb +1 -1
  18. data/app/views/devise/mailer/unlock_instructions.html.erb +1 -1
  19. data/app/views/devise/passwords/edit.html.erb +3 -3
  20. data/app/views/devise/passwords/new.html.erb +2 -2
  21. data/app/views/devise/registrations/edit.html.erb +6 -6
  22. data/app/views/devise/registrations/new.html.erb +4 -4
  23. data/app/views/devise/sessions/new.html.erb +3 -3
  24. data/app/views/devise/unlocks/new.html.erb +2 -2
  25. data/devise.gemspec +1 -1
  26. data/gemfiles/Gemfile.rails-3.2-stable +3 -3
  27. data/gemfiles/Gemfile.rails-4.0-stable +3 -3
  28. data/gemfiles/Gemfile.rails-head +3 -3
  29. data/lib/devise.rb +3 -3
  30. data/lib/devise/controllers/helpers.rb +5 -5
  31. data/lib/devise/controllers/rememberable.rb +3 -3
  32. data/lib/devise/controllers/sign_in_out.rb +8 -8
  33. data/lib/devise/failure_app.rb +3 -3
  34. data/lib/devise/hooks/activatable.rb +1 -1
  35. data/lib/devise/hooks/lockable.rb +1 -1
  36. data/lib/devise/hooks/proxy.rb +1 -1
  37. data/lib/devise/hooks/rememberable.rb +1 -1
  38. data/lib/devise/hooks/timeoutable.rb +1 -1
  39. data/lib/devise/hooks/trackable.rb +1 -1
  40. data/lib/devise/mailers/helpers.rb +8 -8
  41. data/lib/devise/models/authenticatable.rb +3 -3
  42. data/lib/devise/models/confirmable.rb +9 -9
  43. data/lib/devise/models/database_authenticatable.rb +1 -1
  44. data/lib/devise/models/lockable.rb +6 -6
  45. data/lib/devise/models/omniauthable.rb +1 -1
  46. data/lib/devise/models/recoverable.rb +1 -1
  47. data/lib/devise/models/rememberable.rb +3 -3
  48. data/lib/devise/models/trackable.rb +1 -1
  49. data/lib/devise/models/validatable.rb +6 -6
  50. data/lib/devise/modules.rb +9 -9
  51. data/lib/devise/omniauth/url_helpers.rb +2 -2
  52. data/lib/devise/rails.rb +1 -1
  53. data/lib/devise/rails/routes.rb +81 -81
  54. data/lib/devise/test_helpers.rb +2 -2
  55. data/lib/devise/time_inflector.rb +1 -1
  56. data/lib/devise/version.rb +1 -1
  57. data/lib/generators/active_record/devise_generator.rb +6 -6
  58. data/lib/generators/active_record/templates/migration.rb +4 -4
  59. data/lib/generators/active_record/templates/migration_existing.rb +4 -4
  60. data/lib/generators/devise/devise_generator.rb +3 -3
  61. data/lib/generators/devise/views_generator.rb +29 -18
  62. data/lib/generators/mongoid/devise_generator.rb +19 -19
  63. data/lib/generators/templates/README +2 -2
  64. data/lib/generators/templates/devise.rb +9 -7
  65. data/lib/generators/templates/markerb/confirmation_instructions.markerb +1 -1
  66. data/lib/generators/templates/markerb/reset_password_instructions.markerb +1 -1
  67. data/lib/generators/templates/markerb/unlock_instructions.markerb +1 -1
  68. data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +2 -2
  69. data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +4 -4
  70. data/lib/generators/templates/simple_form_for/passwords/new.html.erb +2 -2
  71. data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +6 -6
  72. data/lib/generators/templates/simple_form_for/registrations/new.html.erb +4 -4
  73. data/lib/generators/templates/simple_form_for/sessions/new.html.erb +4 -4
  74. data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +2 -2
  75. data/test/controllers/helpers_test.rb +31 -31
  76. data/test/controllers/internal_helpers_test.rb +6 -6
  77. data/test/controllers/sessions_controller_test.rb +18 -18
  78. data/test/controllers/url_helpers_test.rb +4 -4
  79. data/test/delegator_test.rb +1 -1
  80. data/test/devise_test.rb +3 -3
  81. data/test/failure_app_test.rb +21 -21
  82. data/test/generators/active_record_generator_test.rb +4 -4
  83. data/test/generators/devise_generator_test.rb +2 -2
  84. data/test/generators/mongoid_generator_test.rb +1 -1
  85. data/test/generators/views_generator_test.rb +30 -1
  86. data/test/helpers/devise_helper_test.rb +11 -11
  87. data/test/integration/authenticatable_test.rb +42 -42
  88. data/test/integration/confirmable_test.rb +46 -46
  89. data/test/integration/database_authenticatable_test.rb +16 -16
  90. data/test/integration/http_authenticatable_test.rb +11 -11
  91. data/test/integration/lockable_test.rb +37 -37
  92. data/test/integration/omniauthable_test.rb +3 -3
  93. data/test/integration/recoverable_test.rb +41 -41
  94. data/test/integration/registerable_test.rb +49 -49
  95. data/test/integration/rememberable_test.rb +13 -13
  96. data/test/integration/timeoutable_test.rb +7 -7
  97. data/test/integration/trackable_test.rb +2 -2
  98. data/test/mailers/confirmation_instructions_test.rb +4 -4
  99. data/test/mailers/reset_password_instructions_test.rb +3 -3
  100. data/test/mailers/unlock_instructions_test.rb +2 -2
  101. data/test/models/authenticatable_test.rb +3 -3
  102. data/test/models/confirmable_test.rb +31 -31
  103. data/test/models/database_authenticatable_test.rb +27 -27
  104. data/test/models/lockable_test.rb +29 -29
  105. data/test/models/recoverable_test.rb +19 -19
  106. data/test/models/rememberable_test.rb +8 -8
  107. data/test/models/serializable_test.rb +8 -8
  108. data/test/models/timeoutable_test.rb +1 -1
  109. data/test/models/validatable_test.rb +11 -11
  110. data/test/omniauth/config_test.rb +3 -3
  111. data/test/omniauth/url_helpers_test.rb +3 -3
  112. data/test/parameter_sanitizer_test.rb +1 -1
  113. data/test/rails_app/app/controllers/admins_controller.rb +1 -1
  114. data/test/rails_app/app/controllers/application_controller.rb +2 -2
  115. data/test/rails_app/app/controllers/home_controller.rb +1 -1
  116. data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +2 -2
  117. data/test/rails_app/app/controllers/users_controller.rb +5 -5
  118. data/test/rails_app/app/mailers/users/mailer.rb +4 -4
  119. data/test/rails_app/app/mongoid/admin.rb +11 -11
  120. data/test/rails_app/app/mongoid/shim.rb +2 -2
  121. data/test/rails_app/app/mongoid/user.rb +19 -19
  122. data/test/rails_app/app/views/admins/sessions/new.html.erb +1 -1
  123. data/test/rails_app/app/views/layouts/application.html.erb +1 -1
  124. data/test/rails_app/config/application.rb +2 -2
  125. data/test/rails_app/config/initializers/devise.rb +3 -3
  126. data/test/rails_app/config/initializers/secret_token.rb +1 -1
  127. data/test/rails_app/config/routes.rb +43 -43
  128. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +7 -7
  129. data/test/rails_app/lib/shared_admin.rb +4 -4
  130. data/test/routes_test.rb +59 -59
  131. data/test/support/helpers.rb +4 -4
  132. data/test/support/integration.rb +12 -12
  133. data/test/test_helpers_test.rb +3 -3
  134. data/test/test_models.rb +5 -5
  135. metadata +4 -4
@@ -61,8 +61,8 @@ class OmniauthableIntegrationTest < ActionDispatch::IntegrationTest
61
61
 
62
62
  assert_difference "User.count" do
63
63
  visit "/users/sign_up"
64
- fill_in "Password", :with => "12345678"
65
- fill_in "Password confirmation", :with => "12345678"
64
+ fill_in "Password", with: "12345678"
65
+ fill_in "Password confirmation", with: "12345678"
66
66
  click_button "Sign up"
67
67
  end
68
68
 
@@ -111,7 +111,7 @@ class OmniauthableIntegrationTest < ActionDispatch::IntegrationTest
111
111
  test "generates a proper link when SCRIPT_NAME is set" do
112
112
  header 'SCRIPT_NAME', '/q'
113
113
  visit "/users/sign_in"
114
- assert_select "a", :href => "/q/users/auth/facebook"
114
+ assert_select "a", href: "/q/users/auth/facebook"
115
115
  end
116
116
 
117
117
  test "handles callback error parameter according to the specification" do
@@ -12,7 +12,7 @@ class PasswordTest < ActionDispatch::IntegrationTest
12
12
  assert_response :success
13
13
  assert_not warden.authenticated?(:user)
14
14
 
15
- fill_in 'email', :with => 'user@test.com'
15
+ fill_in 'email', with: 'user@test.com'
16
16
  yield if block_given?
17
17
 
18
18
  Devise.stubs(:friendly_token).returns("abcdef")
@@ -21,21 +21,21 @@ class PasswordTest < ActionDispatch::IntegrationTest
21
21
 
22
22
  def reset_password(options={}, &block)
23
23
  unless options[:visit] == false
24
- visit edit_user_password_path(:reset_password_token => options[:reset_password_token] || "abcdef")
24
+ visit edit_user_password_path(reset_password_token: options[:reset_password_token] || "abcdef")
25
25
  assert_response :success
26
26
  end
27
27
 
28
- fill_in 'New password', :with => '987654321'
29
- fill_in 'Confirm new password', :with => '987654321'
28
+ fill_in 'New password', with: '987654321'
29
+ fill_in 'Confirm new password', with: '987654321'
30
30
  yield if block_given?
31
31
  click_button 'Change my password'
32
32
  end
33
33
 
34
34
  test 'reset password with email of different case should succeed when email is in the list of case insensitive keys' do
35
- create_user(:email => 'Foo@Bar.com')
35
+ create_user(email: 'Foo@Bar.com')
36
36
 
37
37
  request_forgot_password do
38
- fill_in 'email', :with => 'foo@bar.com'
38
+ fill_in 'email', with: 'foo@bar.com'
39
39
  end
40
40
 
41
41
  assert_current_url '/users/sign_in'
@@ -43,11 +43,11 @@ class PasswordTest < ActionDispatch::IntegrationTest
43
43
  end
44
44
 
45
45
  test 'reset password with email should send an email from a custom mailer' do
46
- create_user(:email => 'Foo@Bar.com')
46
+ create_user(email: 'Foo@Bar.com')
47
47
 
48
48
  User.any_instance.stubs(:devise_mailer).returns(Users::Mailer)
49
49
  request_forgot_password do
50
- fill_in 'email', :with => 'foo@bar.com'
50
+ fill_in 'email', with: 'foo@bar.com'
51
51
  end
52
52
 
53
53
  mail = ActionMailer::Base.deliveries.last
@@ -56,11 +56,11 @@ class PasswordTest < ActionDispatch::IntegrationTest
56
56
  end
57
57
 
58
58
  test 'reset password with email of different case should fail when email is NOT the list of case insensitive keys' do
59
- swap Devise, :case_insensitive_keys => [] do
60
- create_user(:email => 'Foo@Bar.com')
59
+ swap Devise, case_insensitive_keys: [] do
60
+ create_user(email: 'Foo@Bar.com')
61
61
 
62
62
  request_forgot_password do
63
- fill_in 'email', :with => 'foo@bar.com'
63
+ fill_in 'email', with: 'foo@bar.com'
64
64
  end
65
65
 
66
66
  assert_response :success
@@ -71,10 +71,10 @@ class PasswordTest < ActionDispatch::IntegrationTest
71
71
  end
72
72
 
73
73
  test 'reset password with email with extra whitespace should succeed when email is in the list of strip whitespace keys' do
74
- create_user(:email => 'foo@bar.com')
74
+ create_user(email: 'foo@bar.com')
75
75
 
76
76
  request_forgot_password do
77
- fill_in 'email', :with => ' foo@bar.com '
77
+ fill_in 'email', with: ' foo@bar.com '
78
78
  end
79
79
 
80
80
  assert_current_url '/users/sign_in'
@@ -82,11 +82,11 @@ class PasswordTest < ActionDispatch::IntegrationTest
82
82
  end
83
83
 
84
84
  test 'reset password with email with extra whitespace should fail when email is NOT the list of strip whitespace keys' do
85
- swap Devise, :strip_whitespace_keys => [] do
86
- create_user(:email => 'foo@bar.com')
85
+ swap Devise, strip_whitespace_keys: [] do
86
+ create_user(email: 'foo@bar.com')
87
87
 
88
88
  request_forgot_password do
89
- fill_in 'email', :with => ' foo@bar.com '
89
+ fill_in 'email', with: ' foo@bar.com '
90
90
  end
91
91
 
92
92
  assert_response :success
@@ -116,7 +116,7 @@ class PasswordTest < ActionDispatch::IntegrationTest
116
116
 
117
117
  test 'not authenticated user with invalid email should receive an error message' do
118
118
  request_forgot_password do
119
- fill_in 'email', :with => 'invalid.test@test.com'
119
+ fill_in 'email', with: 'invalid.test@test.com'
120
120
  end
121
121
 
122
122
  assert_response :success
@@ -141,7 +141,7 @@ class PasswordTest < ActionDispatch::IntegrationTest
141
141
 
142
142
  test 'not authenticated user with invalid reset password token should not be able to change their password' do
143
143
  user = create_user
144
- reset_password :reset_password_token => 'invalid_reset_password'
144
+ reset_password reset_password_token: 'invalid_reset_password'
145
145
 
146
146
  assert_response :success
147
147
  assert_current_url '/users/password'
@@ -154,7 +154,7 @@ class PasswordTest < ActionDispatch::IntegrationTest
154
154
  user = create_user
155
155
  request_forgot_password
156
156
  reset_password do
157
- fill_in 'Confirm new password', :with => 'other_password'
157
+ fill_in 'Confirm new password', with: 'other_password'
158
158
  end
159
159
 
160
160
  assert_response :success
@@ -179,12 +179,12 @@ class PasswordTest < ActionDispatch::IntegrationTest
179
179
  user = create_user
180
180
  request_forgot_password
181
181
 
182
- reset_password { fill_in 'Confirm new password', :with => 'other_password' }
182
+ reset_password { fill_in 'Confirm new password', with: 'other_password' }
183
183
  assert_response :success
184
184
  assert_have_selector '#error_explanation'
185
185
  assert_not user.reload.valid_password?('987654321')
186
186
 
187
- reset_password :visit => false
187
+ reset_password visit: false
188
188
  assert_contain 'Your password was changed successfully.'
189
189
  assert user.reload.valid_password?('987654321')
190
190
  end
@@ -199,8 +199,8 @@ class PasswordTest < ActionDispatch::IntegrationTest
199
199
 
200
200
  test 'does not sign in user automatically after changing its password if it\'s locked and unlock strategy is :none or :time' do
201
201
  [:none, :time].each do |strategy|
202
- swap Devise, :unlock_strategy => strategy do
203
- user = create_user(:locked => true)
202
+ swap Devise, unlock_strategy: strategy do
203
+ user = create_user(locked: true)
204
204
  request_forgot_password
205
205
  reset_password
206
206
 
@@ -213,8 +213,8 @@ class PasswordTest < ActionDispatch::IntegrationTest
213
213
  end
214
214
 
215
215
  test 'unlocks and signs in locked user automatically after changing it\'s password if unlock strategy is :email' do
216
- swap Devise, :unlock_strategy => :email do
217
- user = create_user(:locked => true)
216
+ swap Devise, unlock_strategy: :email do
217
+ user = create_user(locked: true)
218
218
  request_forgot_password
219
219
  reset_password
220
220
 
@@ -225,8 +225,8 @@ class PasswordTest < ActionDispatch::IntegrationTest
225
225
  end
226
226
 
227
227
  test 'unlocks and signs in locked user automatically after changing it\'s password if unlock strategy is :both' do
228
- swap Devise, :unlock_strategy => :both do
229
- user = create_user(:locked => true)
228
+ swap Devise, unlock_strategy: :both do
229
+ user = create_user(locked: true)
230
230
  request_forgot_password
231
231
  reset_password
232
232
 
@@ -238,22 +238,22 @@ class PasswordTest < ActionDispatch::IntegrationTest
238
238
 
239
239
  test 'reset password request with valid E-Mail in XML format should return valid response' do
240
240
  create_user
241
- post user_password_path(:format => 'xml'), :user => {:email => "user@test.com"}
241
+ post user_password_path(format: 'xml'), user: {email: "user@test.com"}
242
242
  assert_response :success
243
243
  assert_equal response.body, { }.to_xml
244
244
  end
245
245
 
246
246
  test 'reset password request with invalid E-Mail in XML format should return valid response' do
247
247
  create_user
248
- post user_password_path(:format => 'xml'), :user => {:email => "invalid.test@test.com"}
248
+ post user_password_path(format: 'xml'), user: {email: "invalid.test@test.com"}
249
249
  assert_response :unprocessable_entity
250
250
  assert response.body.include? %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<errors>)
251
251
  end
252
252
 
253
253
  test 'reset password request with invalid E-Mail in XML format should return empty and valid response' do
254
- swap Devise, :paranoid => true do
254
+ swap Devise, paranoid: true do
255
255
  create_user
256
- post user_password_path(:format => 'xml'), :user => {:email => "invalid@test.com"}
256
+ post user_password_path(format: 'xml'), user: {email: "invalid@test.com"}
257
257
  assert_response :success
258
258
  assert_equal response.body, { }.to_xml
259
259
  end
@@ -262,8 +262,8 @@ class PasswordTest < ActionDispatch::IntegrationTest
262
262
  test 'change password with valid parameters in XML format should return valid response' do
263
263
  create_user
264
264
  request_forgot_password
265
- put user_password_path(:format => 'xml'), :user => {
266
- :reset_password_token => 'abcdef', :password => '987654321', :password_confirmation => '987654321'
265
+ put user_password_path(format: 'xml'), user: {
266
+ reset_password_token: 'abcdef', password: '987654321', password_confirmation: '987654321'
267
267
  }
268
268
  assert_response :success
269
269
  assert warden.authenticated?(:user)
@@ -272,7 +272,7 @@ class PasswordTest < ActionDispatch::IntegrationTest
272
272
  test 'change password with invalid token in XML format should return invalid response' do
273
273
  create_user
274
274
  request_forgot_password
275
- put user_password_path(:format => 'xml'), :user => {:reset_password_token => 'invalid.token', :password => '987654321', :password_confirmation => '987654321'}
275
+ put user_password_path(format: 'xml'), user: {reset_password_token: 'invalid.token', password: '987654321', password_confirmation: '987654321'}
276
276
  assert_response :unprocessable_entity
277
277
  assert response.body.include? %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<errors>)
278
278
  end
@@ -280,24 +280,24 @@ class PasswordTest < ActionDispatch::IntegrationTest
280
280
  test 'change password with invalid new password in XML format should return invalid response' do
281
281
  user = create_user
282
282
  request_forgot_password
283
- put user_password_path(:format => 'xml'), :user => {:reset_password_token => user.reload.reset_password_token, :password => '', :password_confirmation => '987654321'}
283
+ put user_password_path(format: 'xml'), user: {reset_password_token: user.reload.reset_password_token, password: '', password_confirmation: '987654321'}
284
284
  assert_response :unprocessable_entity
285
285
  assert response.body.include? %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<errors>)
286
286
  end
287
287
 
288
288
  test "when using json requests to ask a confirmable request, should not return the object" do
289
- user = create_user(:confirm => false)
289
+ user = create_user(confirm: false)
290
290
 
291
- post user_password_path(:format => :json), :user => { :email => user.email }
291
+ post user_password_path(format: :json), user: { email: user.email }
292
292
 
293
293
  assert_response :success
294
294
  assert_equal response.body, "{}"
295
295
  end
296
296
 
297
297
  test "when in paranoid mode and with an invalid e-mail, asking to reset a password should display a message that does not indicates that the e-mail does not exists in the database" do
298
- swap Devise, :paranoid => true do
298
+ swap Devise, paranoid: true do
299
299
  visit_new_password_path
300
- fill_in "email", :with => "arandomemail@test.com"
300
+ fill_in "email", with: "arandomemail@test.com"
301
301
  click_button 'Send me reset password instructions'
302
302
 
303
303
  assert_not_contain "1 error prohibited this user from being saved:"
@@ -308,10 +308,10 @@ class PasswordTest < ActionDispatch::IntegrationTest
308
308
  end
309
309
 
310
310
  test "when in paranoid mode and with a valid e-mail, asking to reset password should display a message that does not indicates that the email exists in the database and redirect to the failure route" do
311
- swap Devise, :paranoid => true do
311
+ swap Devise, paranoid: true do
312
312
  user = create_user
313
313
  visit_new_password_path
314
- fill_in 'email', :with => user.email
314
+ fill_in 'email', with: user.email
315
315
  click_button 'Send me reset password instructions'
316
316
 
317
317
  assert_contain "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
@@ -8,9 +8,9 @@ class RegistrationTest < ActionDispatch::IntegrationTest
8
8
 
9
9
  assert_template 'registrations/new'
10
10
 
11
- fill_in 'email', :with => 'new_user@test.com'
12
- fill_in 'password', :with => 'new_user123'
13
- fill_in 'password confirmation', :with => 'new_user123'
11
+ fill_in 'email', with: 'new_user@test.com'
12
+ fill_in 'password', with: 'new_user123'
13
+ fill_in 'password confirmation', with: 'new_user123'
14
14
  click_button 'Sign up'
15
15
 
16
16
  assert_contain 'You have signed up successfully'
@@ -26,9 +26,9 @@ class RegistrationTest < ActionDispatch::IntegrationTest
26
26
  get new_admin_session_path
27
27
  click_link 'Sign up'
28
28
 
29
- fill_in 'email', :with => 'new_user@test.com'
30
- fill_in 'password', :with => 'new_user123'
31
- fill_in 'password confirmation', :with => 'new_user123'
29
+ fill_in 'email', with: 'new_user@test.com'
30
+ fill_in 'password', with: 'new_user123'
31
+ fill_in 'password confirmation', with: 'new_user123'
32
32
  click_button 'Sign up'
33
33
 
34
34
  assert_contain 'Welcome! You have signed up successfully.'
@@ -41,9 +41,9 @@ class RegistrationTest < ActionDispatch::IntegrationTest
41
41
 
42
42
  get new_user_registration_path
43
43
 
44
- fill_in 'email', :with => 'new_user@test.com'
45
- fill_in 'password', :with => 'new_user123'
46
- fill_in 'password confirmation', :with => 'new_user123'
44
+ fill_in 'email', with: 'new_user@test.com'
45
+ fill_in 'password', with: 'new_user123'
46
+ fill_in 'password confirmation', with: 'new_user123'
47
47
  click_button 'Sign up'
48
48
  end
49
49
 
@@ -76,9 +76,9 @@ class RegistrationTest < ActionDispatch::IntegrationTest
76
76
  Devise::RegistrationsController.any_instance.stubs(:after_inactive_sign_up_path_for).returns("/?custom=1")
77
77
  get new_user_registration_path
78
78
 
79
- fill_in 'email', :with => 'new_user@test.com'
80
- fill_in 'password', :with => 'new_user123'
81
- fill_in 'password confirmation', :with => 'new_user123'
79
+ fill_in 'email', with: 'new_user@test.com'
80
+ fill_in 'password', with: 'new_user123'
81
+ fill_in 'password confirmation', with: 'new_user123'
82
82
  click_button 'Sign up'
83
83
 
84
84
  assert_current_url "/?custom=1"
@@ -92,9 +92,9 @@ class RegistrationTest < ActionDispatch::IntegrationTest
92
92
 
93
93
  get new_user_registration_path
94
94
 
95
- fill_in 'email', :with => 'invalid_email'
96
- fill_in 'password', :with => 'new_user123'
97
- fill_in 'password confirmation', :with => 'new_user321'
95
+ fill_in 'email', with: 'invalid_email'
96
+ fill_in 'password', with: 'new_user123'
97
+ fill_in 'password confirmation', with: 'new_user321'
98
98
  click_button 'Sign up'
99
99
 
100
100
  assert_template 'registrations/new'
@@ -116,9 +116,9 @@ class RegistrationTest < ActionDispatch::IntegrationTest
116
116
  create_user
117
117
  get new_user_registration_path
118
118
 
119
- fill_in 'email', :with => 'user@test.com'
120
- fill_in 'password', :with => '123456'
121
- fill_in 'password confirmation', :with => '123456'
119
+ fill_in 'email', with: 'user@test.com'
120
+ fill_in 'password', with: '123456'
121
+ fill_in 'password confirmation', with: '123456'
122
122
  click_button 'Sign up'
123
123
 
124
124
  assert_current_url '/users'
@@ -144,8 +144,8 @@ class RegistrationTest < ActionDispatch::IntegrationTest
144
144
  sign_in_as_user
145
145
  get edit_user_registration_path
146
146
 
147
- fill_in 'email', :with => 'user.new@example.com'
148
- fill_in 'current password', :with => '12345678'
147
+ fill_in 'email', with: 'user.new@example.com'
148
+ fill_in 'current password', with: '12345678'
149
149
  click_button 'Update'
150
150
 
151
151
  assert_current_url '/'
@@ -158,9 +158,9 @@ class RegistrationTest < ActionDispatch::IntegrationTest
158
158
  sign_in_as_user
159
159
  get edit_user_registration_path
160
160
 
161
- fill_in 'password', :with => '1234567890'
162
- fill_in 'password confirmation', :with => '1234567890'
163
- fill_in 'current password', :with => '12345678'
161
+ fill_in 'password', with: '1234567890'
162
+ fill_in 'password confirmation', with: '1234567890'
163
+ fill_in 'current password', with: '12345678'
164
164
  click_button 'Update'
165
165
 
166
166
  assert_contain 'You updated your account successfully.'
@@ -172,8 +172,8 @@ class RegistrationTest < ActionDispatch::IntegrationTest
172
172
  sign_in_as_user
173
173
  get edit_user_registration_path
174
174
 
175
- fill_in 'email', :with => 'user.new@example.com'
176
- fill_in 'current password', :with => 'invalid'
175
+ fill_in 'email', with: 'user.new@example.com'
176
+ fill_in 'current password', with: 'invalid'
177
177
  click_button 'Update'
178
178
 
179
179
  assert_template 'registrations/edit'
@@ -187,9 +187,9 @@ class RegistrationTest < ActionDispatch::IntegrationTest
187
187
  sign_in_as_user
188
188
  get edit_user_registration_path
189
189
 
190
- fill_in 'password', :with => 'pass1234'
191
- fill_in 'password confirmation', :with => 'pass1234'
192
- fill_in 'current password', :with => '12345678'
190
+ fill_in 'password', with: 'pass1234'
191
+ fill_in 'password confirmation', with: 'pass1234'
192
+ fill_in 'current password', with: '12345678'
193
193
  click_button 'Update'
194
194
 
195
195
  assert_current_url '/'
@@ -202,9 +202,9 @@ class RegistrationTest < ActionDispatch::IntegrationTest
202
202
  sign_in_as_user
203
203
  get edit_user_registration_path
204
204
 
205
- fill_in 'password', :with => 'pas123'
206
- fill_in 'password confirmation', :with => ''
207
- fill_in 'current password', :with => '12345678'
205
+ fill_in 'password', with: 'pas123'
206
+ fill_in 'password confirmation', with: ''
207
+ fill_in 'current password', with: '12345678'
208
208
  click_button 'Update'
209
209
 
210
210
  assert_contain Devise.rails4? ?
@@ -235,21 +235,21 @@ class RegistrationTest < ActionDispatch::IntegrationTest
235
235
  end
236
236
 
237
237
  test 'a user with XML sign up stub' do
238
- get new_user_registration_path(:format => 'xml')
238
+ get new_user_registration_path(format: 'xml')
239
239
  assert_response :success
240
240
  assert_match %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user>), response.body
241
241
  assert_no_match(/<confirmation-token/, response.body)
242
242
  end
243
243
 
244
244
  test 'a user with JSON sign up stub' do
245
- get new_user_registration_path(:format => 'json')
245
+ get new_user_registration_path(format: 'json')
246
246
  assert_response :success
247
247
  assert_match %({"user":), response.body
248
248
  assert_no_match(/"confirmation_token"/, response.body)
249
249
  end
250
250
 
251
251
  test 'an admin sign up with valid information in XML format should return valid response' do
252
- post admin_registration_path(:format => 'xml'), :admin => { :email => 'new_user@test.com', :password => 'new_user123', :password_confirmation => 'new_user123' }
252
+ post admin_registration_path(format: 'xml'), admin: { email: 'new_user@test.com', password: 'new_user123', password_confirmation: 'new_user123' }
253
253
  assert_response :success
254
254
  assert response.body.include? %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<admin>)
255
255
 
@@ -258,7 +258,7 @@ class RegistrationTest < ActionDispatch::IntegrationTest
258
258
  end
259
259
 
260
260
  test 'a user sign up with valid information in XML format should return valid response' do
261
- post user_registration_path(:format => 'xml'), :user => { :email => 'new_user@test.com', :password => 'new_user123', :password_confirmation => 'new_user123' }
261
+ post user_registration_path(format: 'xml'), user: { email: 'new_user@test.com', password: 'new_user123', password_confirmation: 'new_user123' }
262
262
  assert_response :success
263
263
  assert response.body.include? %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user>)
264
264
 
@@ -267,28 +267,28 @@ class RegistrationTest < ActionDispatch::IntegrationTest
267
267
  end
268
268
 
269
269
  test 'a user sign up with invalid information in XML format should return invalid response' do
270
- post user_registration_path(:format => 'xml'), :user => { :email => 'new_user@test.com', :password => 'new_user123', :password_confirmation => 'invalid' }
270
+ post user_registration_path(format: 'xml'), user: { email: 'new_user@test.com', password: 'new_user123', password_confirmation: 'invalid' }
271
271
  assert_response :unprocessable_entity
272
272
  assert response.body.include? %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<errors>)
273
273
  end
274
274
 
275
275
  test 'a user update information with valid data in XML format should return valid response' do
276
276
  user = sign_in_as_user
277
- put user_registration_path(:format => 'xml'), :user => { :current_password => '12345678', :email => 'user.new@test.com' }
277
+ put user_registration_path(format: 'xml'), user: { current_password: '12345678', email: 'user.new@test.com' }
278
278
  assert_response :success
279
279
  assert_equal user.reload.email, 'user.new@test.com'
280
280
  end
281
281
 
282
282
  test 'a user update information with invalid data in XML format should return invalid response' do
283
283
  user = sign_in_as_user
284
- put user_registration_path(:format => 'xml'), :user => { :current_password => 'invalid', :email => 'user.new@test.com' }
284
+ put user_registration_path(format: 'xml'), user: { current_password: 'invalid', email: 'user.new@test.com' }
285
285
  assert_response :unprocessable_entity
286
286
  assert_equal user.reload.email, 'user@test.com'
287
287
  end
288
288
 
289
289
  test 'a user cancel their account in XML format should return valid response' do
290
290
  sign_in_as_user
291
- delete user_registration_path(:format => 'xml')
291
+ delete user_registration_path(format: 'xml')
292
292
  assert_response :success
293
293
  assert_equal User.count, 0
294
294
  end
@@ -299,8 +299,8 @@ class ReconfirmableRegistrationTest < ActionDispatch::IntegrationTest
299
299
  sign_in_as_admin
300
300
  get edit_admin_registration_path
301
301
 
302
- fill_in 'email', :with => 'admin.new@example.com'
303
- fill_in 'current password', :with => '123456'
302
+ fill_in 'email', with: 'admin.new@example.com'
303
+ fill_in 'current password', with: '123456'
304
304
  click_button 'Update'
305
305
 
306
306
  assert_current_url '/admin_area/home'
@@ -315,9 +315,9 @@ class ReconfirmableRegistrationTest < ActionDispatch::IntegrationTest
315
315
  sign_in_as_admin
316
316
  get edit_admin_registration_path
317
317
 
318
- fill_in 'password', :with => 'pas123'
319
- fill_in 'password confirmation', :with => 'pas123'
320
- fill_in 'current password', :with => '123456'
318
+ fill_in 'password', with: 'pas123'
319
+ fill_in 'password confirmation', with: 'pas123'
320
+ fill_in 'current password', with: '123456'
321
321
  click_button 'Update'
322
322
 
323
323
  assert_current_url '/admin_area/home'
@@ -330,14 +330,14 @@ class ReconfirmableRegistrationTest < ActionDispatch::IntegrationTest
330
330
  sign_in_as_admin
331
331
 
332
332
  get edit_admin_registration_path
333
- fill_in 'email', :with => 'admin.new@example.com'
334
- fill_in 'current password', :with => '123456'
333
+ fill_in 'email', with: 'admin.new@example.com'
334
+ fill_in 'current password', with: '123456'
335
335
  click_button 'Update'
336
336
 
337
337
  get edit_admin_registration_path
338
- fill_in 'password', :with => 'pas123'
339
- fill_in 'password confirmation', :with => 'pas123'
340
- fill_in 'current password', :with => '123456'
338
+ fill_in 'password', with: 'pas123'
339
+ fill_in 'password confirmation', with: 'pas123'
340
+ fill_in 'current password', with: '123456'
341
341
  click_button 'Update'
342
342
 
343
343
  assert_current_url '/admin_area/home'