From 6bf38198949b4c5f53dcaf9b82e915a0cf8eaff3 Mon Sep 17 00:00:00 2001 From: Sergei Tsoganov Date: Mon, 29 May 2023 14:56:09 +0300 Subject: [PATCH] Fixed test --- test/models/api_user_test.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/models/api_user_test.rb b/test/models/api_user_test.rb index 525e6c264..ec53d2371 100644 --- a/test/models/api_user_test.rb +++ b/test/models/api_user_test.rb @@ -22,9 +22,26 @@ class ApiUserTest < ActiveSupport::TestCase assert another_user.invalid? another_user.username = 'another' + another_user.identity_code = '' assert another_user.valid? end + def test_invalid_when_one_registrar_and_identity_code_is_already_taken + user = valid_user + another_user = user.dup + + assert another_user.invalid? + + another_user.username = 'another' + assert another_user.invalid? + end + + def test_valid_when_another_registrar_and_identity_code_is_already_taken + another_user = valid_user + @user.identity_code = another_user.identity_code + assert @user.valid? + end + def test_invalid_without_password user = valid_user user.plain_text_password = ''