Sha256: 073a76fbc64ff33030c802ed6de29091f70f38346e6c7474190d9bb58e206275
Contents?: true
Size: 1.12 KB
Versions: 6
Compression:
Stored size: 1.12 KB
Contents
require "test_helper" class EmailsControllerTest < ActionDispatch::IntegrationTest setup do @<%= singular_table_name %> = sign_in_as(<%= table_name %>(:lazaro_nixon)) end test "should get edit" do get edit_emails_url assert_response :success end test "should update email" do assert_enqueued_email_with EmailMailer, :changed, args: { change: [@<%= singular_table_name %>.email, "new_email@hey.com"] } do patch emails_url, params: { current_password: "secret123", <%= singular_table_name %>: { email: "new_email@hey.com" } } end assert_redirected_to root_path end test "should not update email with wrong current password" do assert_no_enqueued_emails do patch emails_url, params: { current_password: "wrong_password", <%= singular_table_name %>: { email: @<%= singular_table_name %>.email } } end assert_redirected_to edit_emails_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