mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-14 21:24:54 +08:00
22 lines
600 B
Ruby
22 lines
600 B
Ruby
require 'test_helper'
|
|
|
|
class SampleGroupTest < ActiveSupport::TestCase
|
|
def setup
|
|
@sample_group = sample_groups(:blood)
|
|
end
|
|
|
|
should validate_presence_of(:name)
|
|
should validate_length_of(:name).is_at_most(Constants::NAME_MAX_LENGTH)
|
|
should validate_presence_of(:color)
|
|
should validate_length_of(:color).is_at_most(Constants::COLOR_MAX_LENGTH)
|
|
should validate_presence_of(:team)
|
|
|
|
test 'should validate with correct data' do
|
|
assert @sample_group.valid?
|
|
end
|
|
|
|
test 'should not validate without team' do
|
|
@sample_group.team = nil
|
|
assert_not @sample_group.valid?
|
|
end
|
|
end
|