Sha256: c99bed11b838e2cd70ecfeda9a7b7a594eba974c9169114044499090634f3472
Contents?: true
Size: 1.14 KB
Versions: 31
Compression:
Stored size: 1.14 KB
Contents
require "test_helper" class SessionsControllerTest < ActionDispatch::IntegrationTest setup do @user = users(:lazaro_nixon) end test "should get index" do sign_in_as @user get sessions_url assert_response :success end test "should get new" do get sign_in_url assert_response :success end test "should sign in" do post sign_in_url, params: { email: @user.email, password: "Secret1*3*5*" } assert_enqueued_email_with SessionMailer, :signed_in_notification, args: { session: @user.sessions.last } assert_redirected_to root_url get root_url assert_response :success end test "should not sign in with wrong credentials" do post sign_in_url, params: { email: @user.email, password: "SecretWrong1*3" } assert_redirected_to sign_in_url(email_hint: @user.email) assert_equal "That email or password is incorrect", flash[:alert] get root_url assert_redirected_to sign_in_url end test "should sign out" do sign_in_as @user delete session_url(@user.sessions.last) assert_redirected_to sessions_url follow_redirect! assert_redirected_to sign_in_url end end
Version data entries
31 entries across 31 versions & 1 rubygems