Make sure we show errors correctly when resetting a password
This commit is contained in:
parent
7fd1e55938
commit
a70898be6d
2 changed files with 7 additions and 1 deletions
|
@ -2,7 +2,7 @@
|
||||||
<h1><%= t 'user.reset_password.heading', :user => current_user.display_name %></h1>
|
<h1><%= t 'user.reset_password.heading', :user => current_user.display_name %></h1>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= error_messages_for :user %>
|
<%= error_messages_for current_user %>
|
||||||
|
|
||||||
<%= form_tag do %>
|
<%= form_tag do %>
|
||||||
<%= hidden_field_tag(:token, params[:token]) %>
|
<%= hidden_field_tag(:token, params[:token]) %>
|
||||||
|
|
|
@ -749,6 +749,12 @@ class UserControllerTest < ActionController::TestCase
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template :reset_password
|
assert_template :reset_password
|
||||||
|
|
||||||
|
# Test that errors are reported for erroneous submissions
|
||||||
|
post :reset_password, :params => { :token => token.token, :user => { :pass_crypt => "new_password", :pass_crypt_confirmation => "different_password" } }
|
||||||
|
assert_response :success
|
||||||
|
assert_template :reset_password
|
||||||
|
assert_select "div#errorExplanation"
|
||||||
|
|
||||||
# Test setting a new password
|
# Test setting a new password
|
||||||
post :reset_password, :params => { :token => token.token, :user => { :pass_crypt => "new_password", :pass_crypt_confirmation => "new_password" } }
|
post :reset_password, :params => { :token => token.token, :user => { :pass_crypt => "new_password", :pass_crypt_confirmation => "new_password" } }
|
||||||
assert_response :redirect
|
assert_response :redirect
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue