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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/Gemfile +2 -2
- data/Gemfile.lock +6 -6
- data/README.md +7 -0
- data/Rakefile +1 -1
- data/app/controllers/devise/confirmations_controller.rb +2 -2
- data/app/controllers/devise/omniauth_callbacks_controller.rb +2 -2
- data/app/controllers/devise/passwords_controller.rb +3 -3
- data/app/controllers/devise/registrations_controller.rb +7 -7
- data/app/controllers/devise/sessions_controller.rb +6 -6
- data/app/controllers/devise/unlocks_controller.rb +2 -2
- data/app/controllers/devise_controller.rb +3 -3
- data/app/helpers/devise_helper.rb +2 -2
- data/app/views/devise/confirmations/new.html.erb +2 -2
- data/app/views/devise/mailer/confirmation_instructions.html.erb +1 -1
- data/app/views/devise/mailer/reset_password_instructions.html.erb +1 -1
- data/app/views/devise/mailer/unlock_instructions.html.erb +1 -1
- data/app/views/devise/passwords/edit.html.erb +3 -3
- data/app/views/devise/passwords/new.html.erb +2 -2
- data/app/views/devise/registrations/edit.html.erb +6 -6
- data/app/views/devise/registrations/new.html.erb +4 -4
- data/app/views/devise/sessions/new.html.erb +3 -3
- data/app/views/devise/unlocks/new.html.erb +2 -2
- data/devise.gemspec +1 -1
- data/gemfiles/Gemfile.rails-3.2-stable +3 -3
- data/gemfiles/Gemfile.rails-4.0-stable +3 -3
- data/gemfiles/Gemfile.rails-head +3 -3
- data/lib/devise.rb +3 -3
- data/lib/devise/controllers/helpers.rb +5 -5
- data/lib/devise/controllers/rememberable.rb +3 -3
- data/lib/devise/controllers/sign_in_out.rb +8 -8
- data/lib/devise/failure_app.rb +3 -3
- data/lib/devise/hooks/activatable.rb +1 -1
- data/lib/devise/hooks/lockable.rb +1 -1
- data/lib/devise/hooks/proxy.rb +1 -1
- data/lib/devise/hooks/rememberable.rb +1 -1
- data/lib/devise/hooks/timeoutable.rb +1 -1
- data/lib/devise/hooks/trackable.rb +1 -1
- data/lib/devise/mailers/helpers.rb +8 -8
- data/lib/devise/models/authenticatable.rb +3 -3
- data/lib/devise/models/confirmable.rb +9 -9
- data/lib/devise/models/database_authenticatable.rb +1 -1
- data/lib/devise/models/lockable.rb +6 -6
- data/lib/devise/models/omniauthable.rb +1 -1
- data/lib/devise/models/recoverable.rb +1 -1
- data/lib/devise/models/rememberable.rb +3 -3
- data/lib/devise/models/trackable.rb +1 -1
- data/lib/devise/models/validatable.rb +6 -6
- data/lib/devise/modules.rb +9 -9
- data/lib/devise/omniauth/url_helpers.rb +2 -2
- data/lib/devise/rails.rb +1 -1
- data/lib/devise/rails/routes.rb +81 -81
- data/lib/devise/test_helpers.rb +2 -2
- data/lib/devise/time_inflector.rb +1 -1
- data/lib/devise/version.rb +1 -1
- data/lib/generators/active_record/devise_generator.rb +6 -6
- data/lib/generators/active_record/templates/migration.rb +4 -4
- data/lib/generators/active_record/templates/migration_existing.rb +4 -4
- data/lib/generators/devise/devise_generator.rb +3 -3
- data/lib/generators/devise/views_generator.rb +29 -18
- data/lib/generators/mongoid/devise_generator.rb +19 -19
- data/lib/generators/templates/README +2 -2
- data/lib/generators/templates/devise.rb +9 -7
- data/lib/generators/templates/markerb/confirmation_instructions.markerb +1 -1
- data/lib/generators/templates/markerb/reset_password_instructions.markerb +1 -1
- data/lib/generators/templates/markerb/unlock_instructions.markerb +1 -1
- data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +2 -2
- data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +4 -4
- data/lib/generators/templates/simple_form_for/passwords/new.html.erb +2 -2
- data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +6 -6
- data/lib/generators/templates/simple_form_for/registrations/new.html.erb +4 -4
- data/lib/generators/templates/simple_form_for/sessions/new.html.erb +4 -4
- data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +2 -2
- data/test/controllers/helpers_test.rb +31 -31
- data/test/controllers/internal_helpers_test.rb +6 -6
- data/test/controllers/sessions_controller_test.rb +18 -18
- data/test/controllers/url_helpers_test.rb +4 -4
- data/test/delegator_test.rb +1 -1
- data/test/devise_test.rb +3 -3
- data/test/failure_app_test.rb +21 -21
- data/test/generators/active_record_generator_test.rb +4 -4
- data/test/generators/devise_generator_test.rb +2 -2
- data/test/generators/mongoid_generator_test.rb +1 -1
- data/test/generators/views_generator_test.rb +30 -1
- data/test/helpers/devise_helper_test.rb +11 -11
- data/test/integration/authenticatable_test.rb +42 -42
- data/test/integration/confirmable_test.rb +46 -46
- data/test/integration/database_authenticatable_test.rb +16 -16
- data/test/integration/http_authenticatable_test.rb +11 -11
- data/test/integration/lockable_test.rb +37 -37
- data/test/integration/omniauthable_test.rb +3 -3
- data/test/integration/recoverable_test.rb +41 -41
- data/test/integration/registerable_test.rb +49 -49
- data/test/integration/rememberable_test.rb +13 -13
- data/test/integration/timeoutable_test.rb +7 -7
- data/test/integration/trackable_test.rb +2 -2
- data/test/mailers/confirmation_instructions_test.rb +4 -4
- data/test/mailers/reset_password_instructions_test.rb +3 -3
- data/test/mailers/unlock_instructions_test.rb +2 -2
- data/test/models/authenticatable_test.rb +3 -3
- data/test/models/confirmable_test.rb +31 -31
- data/test/models/database_authenticatable_test.rb +27 -27
- data/test/models/lockable_test.rb +29 -29
- data/test/models/recoverable_test.rb +19 -19
- data/test/models/rememberable_test.rb +8 -8
- data/test/models/serializable_test.rb +8 -8
- data/test/models/timeoutable_test.rb +1 -1
- data/test/models/validatable_test.rb +11 -11
- data/test/omniauth/config_test.rb +3 -3
- data/test/omniauth/url_helpers_test.rb +3 -3
- data/test/parameter_sanitizer_test.rb +1 -1
- data/test/rails_app/app/controllers/admins_controller.rb +1 -1
- data/test/rails_app/app/controllers/application_controller.rb +2 -2
- data/test/rails_app/app/controllers/home_controller.rb +1 -1
- data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +2 -2
- data/test/rails_app/app/controllers/users_controller.rb +5 -5
- data/test/rails_app/app/mailers/users/mailer.rb +4 -4
- data/test/rails_app/app/mongoid/admin.rb +11 -11
- data/test/rails_app/app/mongoid/shim.rb +2 -2
- data/test/rails_app/app/mongoid/user.rb +19 -19
- data/test/rails_app/app/views/admins/sessions/new.html.erb +1 -1
- data/test/rails_app/app/views/layouts/application.html.erb +1 -1
- data/test/rails_app/config/application.rb +2 -2
- data/test/rails_app/config/initializers/devise.rb +3 -3
- data/test/rails_app/config/initializers/secret_token.rb +1 -1
- data/test/rails_app/config/routes.rb +43 -43
- data/test/rails_app/db/migrate/20100401102949_create_tables.rb +7 -7
- data/test/rails_app/lib/shared_admin.rb +4 -4
- data/test/routes_test.rb +59 -59
- data/test/support/helpers.rb +4 -4
- data/test/support/integration.rb +12 -12
- data/test/test_helpers_test.rb +3 -3
- data/test/test_models.rb +5 -5
- 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", :
|
65
|
-
fill_in "Password confirmation", :
|
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", :
|
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', :
|
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(:
|
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', :
|
29
|
-
fill_in 'Confirm new password', :
|
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(:
|
35
|
+
create_user(email: 'Foo@Bar.com')
|
36
36
|
|
37
37
|
request_forgot_password do
|
38
|
-
fill_in 'email', :
|
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(:
|
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', :
|
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, :
|
60
|
-
create_user(:
|
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', :
|
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(:
|
74
|
+
create_user(email: 'foo@bar.com')
|
75
75
|
|
76
76
|
request_forgot_password do
|
77
|
-
fill_in 'email', :
|
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, :
|
86
|
-
create_user(:
|
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', :
|
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', :
|
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 :
|
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', :
|
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', :
|
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 :
|
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, :
|
203
|
-
user = create_user(:
|
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, :
|
217
|
-
user = create_user(:
|
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, :
|
229
|
-
user = create_user(:
|
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(:
|
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(:
|
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, :
|
254
|
+
swap Devise, paranoid: true do
|
255
255
|
create_user
|
256
|
-
post user_password_path(:
|
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(:
|
266
|
-
:
|
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(:
|
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(:
|
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(:
|
289
|
+
user = create_user(confirm: false)
|
290
290
|
|
291
|
-
post user_password_path(:
|
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, :
|
298
|
+
swap Devise, paranoid: true do
|
299
299
|
visit_new_password_path
|
300
|
-
fill_in "email", :
|
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, :
|
311
|
+
swap Devise, paranoid: true do
|
312
312
|
user = create_user
|
313
313
|
visit_new_password_path
|
314
|
-
fill_in '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', :
|
12
|
-
fill_in 'password', :
|
13
|
-
fill_in 'password confirmation', :
|
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', :
|
30
|
-
fill_in 'password', :
|
31
|
-
fill_in 'password confirmation', :
|
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', :
|
45
|
-
fill_in 'password', :
|
46
|
-
fill_in 'password confirmation', :
|
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', :
|
80
|
-
fill_in 'password', :
|
81
|
-
fill_in 'password confirmation', :
|
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', :
|
96
|
-
fill_in 'password', :
|
97
|
-
fill_in 'password confirmation', :
|
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', :
|
120
|
-
fill_in 'password', :
|
121
|
-
fill_in 'password confirmation', :
|
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', :
|
148
|
-
fill_in 'current password', :
|
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', :
|
162
|
-
fill_in 'password confirmation', :
|
163
|
-
fill_in 'current password', :
|
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', :
|
176
|
-
fill_in 'current password', :
|
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', :
|
191
|
-
fill_in 'password confirmation', :
|
192
|
-
fill_in 'current password', :
|
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', :
|
206
|
-
fill_in 'password confirmation', :
|
207
|
-
fill_in 'current password', :
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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', :
|
303
|
-
fill_in 'current password', :
|
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', :
|
319
|
-
fill_in 'password confirmation', :
|
320
|
-
fill_in 'current password', :
|
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', :
|
334
|
-
fill_in 'current password', :
|
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', :
|
339
|
-
fill_in 'password confirmation', :
|
340
|
-
fill_in 'current password', :
|
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'
|