Sha256: 2bfc85a11a7b2d246599ac29f794d8e453435c85f7155aef1d9d99e8fb3e707b

Contents?: true

Size: 1.75 KB

Versions: 9

Compression:

Stored size: 1.75 KB

Contents

require "test/unit"
require_relative "./students_list.rb"
require_relative "./attr_limited_regex_accessor.rb"
require_relative "./students_list_adapter.rb"
require_relative "./database/students_list_db.rb"
require_relative "./student/student.rb"
require_relative "./data_list.rb"

class StudentsTests < Test::Unit::TestCase
    def test_add
        @students = StudentsList.new(
            StudentsListDBAdapter.new(
                StudentsListDB
            )
        )

        @start_count = @students.count
        
        @students.add_student(
            Student.new(
                lastname: "AAA",
                firstname: "BBB",
                patronymic: "CCC",
                params: {
                    email: "test@email.com"
                }
            )    
        )

        assert_equal(1, @students.count - @start_count)
    end

    def test_delete
        @students = StudentsList.new(
            StudentsListDBAdapter.new(
                StudentsListDB
            )
        )

        @students.add_student(
            Student.new(
                lastname: "AAA",
                firstname: "BBB",
                patronymic: "CCC",
                params: {
                    email: "test@email.com"
                }
            )    
        )

        @students.add_student(
            Student.new(
                lastname: "AAA",
                firstname: "BBB",
                patronymic: "CCC",
                params: {
                    email: "test@email.com"
                }
            )    
        )

        @current_count = @students.count

        @students_list = @students.get_students(0, 10, nil)

        @students.remove_student(@students_list[0].id)

        assert_equal(1, @current_count - @students.count)
    end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
mc_delta-0.4.0 lib/source/students_tests.rb
mc_delta-0.3.0 lib/source/students_tests.rb
mc_delta-0.2.0 lib/source/students_tests.rb
mc_delta-0.1.0 lib/source/students_tests.rb
model_gem-0.2.0 lib/model_gem_source/students_tests.rb
model_gem-0.1.9 lib/model_gem_source/students_tests.rb
model_gem-0.1.8 lib/model_gem_source/students_tests.rb
model_gem-0.1.7 ./model_gem_source/students_tests.rb
model_gem-0.1.6 ./model_gem_source/students_tests.rb