mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-15 13:45:25 +08:00
33 lines
1.3 KiB
Ruby
33 lines
1.3 KiB
Ruby
require 'test_helper'
|
|
require 'helpers/archivable_model_test_helper'
|
|
require 'helpers/searchable_model_test_helper'
|
|
|
|
class ExperimentTest < ActiveSupport::TestCase
|
|
should validate_presence_of(:name)
|
|
should validate_length_of(:name).is_at_least(4).is_at_most(50)
|
|
should validate_presence_of(:project)
|
|
should validate_presence_of(:created_by)
|
|
should validate_presence_of(:last_modified_by)
|
|
should validate_length_of(:description).is_at_most(255)
|
|
|
|
should have_db_column(:name).of_type(:string)
|
|
should have_db_column(:description).of_type(:text)
|
|
should have_db_column(:project_id).of_type(:integer)
|
|
should have_db_column(:created_by_id).of_type(:integer)
|
|
should have_db_column(:last_modified_by_id).of_type(:integer)
|
|
should have_db_column(:archived).of_type(:boolean)
|
|
should have_db_column(:archived_by_id).of_type(:integer)
|
|
should have_db_column(:archived_on).of_type(:datetime)
|
|
should have_db_column(:restored_by_id).of_type(:integer)
|
|
should have_db_column(:restored_on).of_type(:datetime)
|
|
should have_db_column(:created_at).of_type(:datetime)
|
|
should have_db_column(:updated_at).of_type(:datetime)
|
|
|
|
should belong_to(:project)
|
|
should belong_to(:created_by)
|
|
should belong_to(:last_modified_by)
|
|
should belong_to(:archived_by)
|
|
should belong_to(:restored_by)
|
|
should have_many(:my_modules)
|
|
should have_many(:my_module_groups)
|
|
end
|