Class: StudentTest
- Inherits:
-
Minitest::Test
- Object
- Minitest::Test
- StudentTest
- Defined in:
- lib/source/student/student_test.rb
Instance Method Summary collapse
- #setup ⇒ Object
- #teardown ⇒ Object
- #test_short_name ⇒ Object
- #test_student_create ⇒ Object
- #test_student_empty_fields ⇒ Object
- #test_student_from_and_to_hash ⇒ Object
- #test_student_has_contacts ⇒ Object
- #test_student_has_git ⇒ Object
- #test_student_set_contacts ⇒ Object
Instance Method Details
#setup ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/source/student/student_test.rb', line 6 def setup @student = Student.new( first_name: 'Тест', middle_name: 'Тестович', surname: 'Тестов', id: 404, phone_number: '+71111111111', telegram: '@test', mail: '[email protected]', git: 'github.com/vanSuper' ) end |
#teardown ⇒ Object
19 20 21 |
# File 'lib/source/student/student_test.rb', line 19 def teardown # метод который отвечает за то, что делать после выполнения всех тестов end |
#test_short_name ⇒ Object
57 58 59 |
# File 'lib/source/student/student_test.rb', line 57 def test_short_name assert_equal 'Тестов Т. Т.', @student.short_name end |
#test_student_create ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/source/student/student_test.rb', line 24 def test_student_create assert @student.first_name == 'Тест' assert @student.middle_name == 'Тестович' assert @student.surname == 'Тестов' assert @student.id == 404 assert @student.phone_number == '+71111111111' assert @student.telegram == '@test' assert @student.mail == '[email protected]' assert @student.git == 'github.com/vanSuper' end |
#test_student_empty_fields ⇒ Object
35 36 37 |
# File 'lib/source/student/student_test.rb', line 35 def test_student_empty_fields Student.new(surname: 'Паттернов', first_name: 'Шаблон', middle_name: 'Одиночкович') end |
#test_student_from_and_to_hash ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/source/student/student_test.rb', line 61 def test_student_from_and_to_hash test_hash = { first_name: 'Манукьян', middle_name: 'Артур', surname: 'Вагинакович', id: 2, phone_number: '+79991112233', telegram: '@ilovebrawlstars', mail: '[email protected]', git: 'github.com/vanSuper' } stud = Student.from_hash(test_hash) assert stud.first_name == 'Манукьян' assert stud.middle_name == 'Артур' assert stud.surname == 'Вагинакович' assert stud.id == 2 assert stud.phone_number == '+79991112233' assert stud.telegram == '@ilovebrawlstars' assert stud.mail == '[email protected]' assert stud.git == 'github.com/vanSuper' assert stud.to_hash == test_hash end |
#test_student_has_contacts ⇒ Object
39 40 41 |
# File 'lib/source/student/student_test.rb', line 39 def test_student_has_contacts assert @student.exist_contact? == true end |
#test_student_has_git ⇒ Object
43 44 45 |
# File 'lib/source/student/student_test.rb', line 43 def test_student_has_git assert @student.exist_git? == true end |
#test_student_set_contacts ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'lib/source/student/student_test.rb', line 47 def test_student_set_contacts stud = Student.new(surname: 'Тестов', first_name: 'Тест', middle_name: 'Тестович') stud.set_contacts(phone_number: '+77777777777', telegram: '@boss777', mail: '[email protected]') assert stud.phone_number == '+77777777777' assert stud.telegram == '@boss777' assert stud.mail == '[email protected]' end |