Sha256: 82cd244da91658db7ca496e46113d6143972f2eeeda2d080401a0ce374f96d4b
Contents?: true
Size: 1.2 KB
Versions: 6
Compression:
Stored size: 1.2 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_passwords_url assert_response :success end test "should update password" do assert_enqueued_email_with PasswordMailer, :changed, args: { <%= singular_table_name %>: @<%= singular_table_name %> } do patch passwords_url, params: { current_password: "secret123", <%= singular_table_name %>: { password: "new_password", password_confirmation: "new_password" } } end assert_redirected_to root_path end test "should not update password with wrong current password" do assert_no_enqueued_emails do patch passwords_url, params: { current_password: "wrong_password", <%= singular_table_name %>: { password: "new_password", password_confirmation: "new_password" } } end assert_redirected_to edit_passwords_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" }); user end end
Version data entries
6 entries across 6 versions & 1 rubygems