From 85cef03a56147d50b7252063b0e45831c0eadce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gaya?= <sebastien.gaya@gmail.com> Date: Thu, 19 Jan 2023 15:41:40 +0100 Subject: [PATCH] test experiences invalid --- .../extranet/experiences_controller_test.rb | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/controllers/extranet/experiences_controller_test.rb b/test/controllers/extranet/experiences_controller_test.rb index 00f2aa35d..a46eed81b 100644 --- a/test/controllers/extranet/experiences_controller_test.rb +++ b/test/controllers/extranet/experiences_controller_test.rb @@ -22,6 +22,19 @@ class Extranet::ExperiencesControllerTest < ActionDispatch::IntegrationTest end end + def test_create_invalid + assert_no_difference("alumnus.experiences.count") do + post experiences_path, params: { + university_person_experience: { + description: "Stage", + from_year: 2022, + to_year: 2022 + } + } + assert_response(:success) + end + end + def test_edit get edit_experience_path(university_person_experiences(:default_experience)) assert_response(:success) @@ -40,4 +53,15 @@ class Extranet::ExperiencesControllerTest < ActionDispatch::IntegrationTest assert_equal("Alternance", experience.reload.description) end + def test_update_invalid + experience = university_person_experiences(:default_experience) + + patch experience_path(experience), params: { + university_person_experience: { + organization_id: "" + } + } + assert_response(:success) + end + end -- GitLab