/
Dmitry-F
/
cbt_tool
Обзор
Документация
Войти
/
Dmitry-F
/
cbt_tool
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
develop
test/controllers/auth_sessions_controller_test.rb
43 строки
1 KB
Dmitriy-Filatov
test: завершение модульных тестов
27 мар 2026, 15:10
27 мар 2026, 15:10
5327127
Код
Авторство
О чём код?
require "test_helper" class AuthSessionsControllerTest < ActionDispatch::IntegrationTest include FactoryBot::Syntax::Methods def setup @therapist = create(:therapist, email: "test@example.com", password: "password123") end test "should get new" do get signin_path assert_response :success end test "should login with correct credentials" do post auth_signin_path, params: { email: @therapist.email, password: "password123" } assert_redirected_to clients_path follow_redirect! assert_response :success end test "should not login with wrong password" do post auth_signin_path, params: { email: @therapist.email, password: "wrong" } assert_response :unprocessable_entity assert_select "div", /Неверный пароль/ end test "should not login with non-existent email" do post auth_signin_path, params: { email: "nonexistent@example.com", password: "password123" } assert_response :unprocessable_entity assert_select "div", /Пользователь с таким email не зарегистрирован/ end test "should logout" do post auth_signin_path, params: { email: @therapist.email, password: "password123" } assert_redirected_to clients_path delete logout_path assert_redirected_to signin_path follow_redirect! assert_response :success end end