Sha256: b9b45e3bfaa550ca19faec60f1a3bd09faab22f1a0731bf51eeb694ff1a3268d
Contents?: true
Size: 1.04 KB
Versions: 9
Compression:
Stored size: 1.04 KB
Contents
require "test_helper" class PasswordsControllerTest < ActionDispatch::IntegrationTest setup do @<%= singular_table_name %> = sign_in_as(<%= table_name %>(:lazaro_nixon)) end test "should get edit" do get edit_password_url assert_response :success end test "should update password" do patch password_url, params: { current_password: "secret123", <%= singular_table_name %>: { password: "new_password", password_confirmation: "new_password" } } assert_redirected_to root_path end test "should not update password with wrong current password" do patch password_url, params: { current_password: "wrong_password", <%= singular_table_name %>: { password: "new_password", password_confirmation: "new_password" } } assert_redirected_to edit_password_path assert_equal "The current password you entered is incorrect", flash[:alert] end def sign_in_as(<%= singular_table_name %>) post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "secret123" }); <%= singular_table_name %> end end
Version data entries
9 entries across 9 versions & 1 rubygems