mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 17:51:13 +08:00
Added missing constants namespace to constants in test models.
This commit is contained in:
parent
a31753ea39
commit
56293ad62d
17 changed files with 29 additions and 30 deletions
3
test/fixtures/user_organizations.yml
vendored
3
test/fixtures/user_organizations.yml
vendored
|
@ -77,7 +77,7 @@ without_user:
|
|||
user: 0
|
||||
organization: nib
|
||||
role: 1
|
||||
assigned_by: steve
|
||||
assigned_by: steve
|
||||
|
||||
without_organization:
|
||||
user: nora
|
||||
|
@ -96,4 +96,3 @@ with_invalid_organization:
|
|||
organization_id: 999999
|
||||
role: 1
|
||||
assigned_by: steve
|
||||
|
||||
|
|
3
test/fixtures/user_projects.yml
vendored
3
test/fixtures/user_projects.yml
vendored
|
@ -98,7 +98,7 @@ without_user:
|
|||
user: 0
|
||||
project: decathlon
|
||||
role: 1
|
||||
assigned_by: steve
|
||||
assigned_by: steve
|
||||
|
||||
without_project:
|
||||
user: nora
|
||||
|
@ -117,4 +117,3 @@ with_invalid_project:
|
|||
project_id: 999999
|
||||
role: 1
|
||||
assigned_by: steve
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'test_helper'
|
|||
class ChecklistItemTest < ActiveSupport::TestCase
|
||||
should validate_presence_of(:text)
|
||||
should validate_length_of(:text)
|
||||
.is_at_most(TEXT_MAX_LENGTH)
|
||||
.is_at_most(Constants::TEXT_MAX_LENGTH)
|
||||
|
||||
test "should validate with correct data" do
|
||||
chkItem = ChecklistItem.new(
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'test_helper'
|
|||
class ChecklistTest < ActiveSupport::TestCase
|
||||
should validate_presence_of(:step)
|
||||
should validate_presence_of(:name)
|
||||
should validate_length_of(:name).is_at_most(TEXT_MAX_LENGTH)
|
||||
should validate_length_of(:name).is_at_most(Constants::TEXT_MAX_LENGTH)
|
||||
|
||||
test "should validate with correct data" do
|
||||
checklist = Checklist.new(
|
||||
|
|
|
@ -14,7 +14,7 @@ class CommentTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
should validate_presence_of(:message)
|
||||
should validate_length_of(:message).is_at_most(TEXT_MAX_LENGTH)
|
||||
should validate_length_of(:message).is_at_most(Constants::TEXT_MAX_LENGTH)
|
||||
|
||||
test "should validate" do
|
||||
assert @valid.valid?
|
||||
|
|
|
@ -6,7 +6,7 @@ class CustomFieldTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
should validate_presence_of(:name)
|
||||
should validate_length_of(:name).is_at_most(NAME_MAX_LENGTH)
|
||||
should validate_length_of(:name).is_at_most(Constants::NAME_MAX_LENGTH)
|
||||
should validate_exclusion_of(:name)
|
||||
.in_array(['Assigned',
|
||||
'Sample name',
|
||||
|
|
|
@ -4,13 +4,13 @@ require 'helpers/searchable_model_test_helper'
|
|||
|
||||
class ExperimentTest < ActiveSupport::TestCase
|
||||
should validate_length_of(:name)
|
||||
.is_at_least(NAME_MIN_LENGTH)
|
||||
.is_at_most(NAME_MAX_LENGTH)
|
||||
.is_at_least(Constants::NAME_MIN_LENGTH)
|
||||
.is_at_most(Constants::NAME_MAX_LENGTH)
|
||||
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(TEXT_MAX_LENGTH)
|
||||
.is_at_most(Constants::TEXT_MAX_LENGTH)
|
||||
|
||||
should have_db_column(:name).of_type(:string)
|
||||
should have_db_column(:description).of_type(:text)
|
||||
|
|
|
@ -10,7 +10,7 @@ class MyModuleGroupTest < ActiveSupport::TestCase
|
|||
|
||||
should validate_presence_of(:name)
|
||||
should validate_length_of(:name)
|
||||
.is_at_most(NAME_MAX_LENGTH)
|
||||
.is_at_most(Constants::NAME_MAX_LENGTH)
|
||||
|
||||
test "should validate with valid data" do
|
||||
assert @module_group.valid?
|
||||
|
|
|
@ -11,8 +11,8 @@ class MyModuleTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
should validate_length_of(:name)
|
||||
.is_at_least(NAME_MIN_LENGTH)
|
||||
.is_at_most(NAME_MAX_LENGTH)
|
||||
.is_at_least(Constants::NAME_MIN_LENGTH)
|
||||
.is_at_most(Constants::NAME_MAX_LENGTH)
|
||||
|
||||
test "should validate valid module object" do
|
||||
assert @my_module.valid?
|
||||
|
|
|
@ -6,11 +6,11 @@ class OrganizationTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
should validate_length_of(:name)
|
||||
.is_at_least(NAME_MIN_LENGTH)
|
||||
.is_at_most(NAME_MAX_LENGTH)
|
||||
.is_at_least(Constants::NAME_MIN_LENGTH)
|
||||
.is_at_most(Constants::NAME_MAX_LENGTH)
|
||||
|
||||
should validate_length_of(:description)
|
||||
.is_at_most(TEXT_MAX_LENGTH)
|
||||
.is_at_most(Constants::TEXT_MAX_LENGTH)
|
||||
|
||||
test "should validate organization default values" do
|
||||
assert @org.valid?
|
||||
|
|
|
@ -13,8 +13,8 @@ class ProjectTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
should validate_length_of(:name)
|
||||
.is_at_least(NAME_MIN_LENGTH)
|
||||
.is_at_most(NAME_MAX_LENGTH)
|
||||
.is_at_least(Constants::NAME_MIN_LENGTH)
|
||||
.is_at_most(Constants::NAME_MAX_LENGTH)
|
||||
|
||||
test "should have non-blank name" do
|
||||
@project.name = ""
|
||||
|
|
|
@ -7,5 +7,5 @@ class ProtocolKeywordTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
should validate_presence_of(:name)
|
||||
should validate_length_of(:name).is_at_most(NAME_MAX_LENGTH)
|
||||
should validate_length_of(:name).is_at_most(Constants::NAME_MAX_LENGTH)
|
||||
end
|
||||
|
|
|
@ -13,8 +13,8 @@ class ProtocolTest < ActiveSupport::TestCase
|
|||
)
|
||||
end
|
||||
|
||||
should validate_length_of(:name).is_at_most(NAME_MAX_LENGTH)
|
||||
should validate_length_of(:description).is_at_most(TEXT_MAX_LENGTH)
|
||||
should validate_length_of(:name).is_at_most(Constants::NAME_MAX_LENGTH)
|
||||
should validate_length_of(:description).is_at_most(Constants::TEXT_MAX_LENGTH)
|
||||
|
||||
test "protocol_type enum works" do
|
||||
@p.protocol_type = :unlinked
|
||||
|
|
|
@ -12,11 +12,11 @@ class ReportTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
should validate_length_of(:name)
|
||||
.is_at_least(NAME_MIN_LENGTH)
|
||||
.is_at_most(NAME_MAX_LENGTH)
|
||||
.is_at_least(Constants::NAME_MIN_LENGTH)
|
||||
.is_at_most(Constants::NAME_MAX_LENGTH)
|
||||
|
||||
should validate_length_of(:description)
|
||||
.is_at_most(TEXT_MAX_LENGTH)
|
||||
.is_at_most(Constants::TEXT_MAX_LENGTH)
|
||||
|
||||
test "should validate with valid data" do
|
||||
assert @report.valid?, "Report with valid data was invalid"
|
||||
|
|
|
@ -6,9 +6,9 @@ class SampleGroupTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
should validate_presence_of(:name)
|
||||
should validate_length_of(:name).is_at_most(NAME_MAX_LENGTH)
|
||||
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(COLOR_MAX_LENGTH)
|
||||
should validate_length_of(:color).is_at_most(Constants::COLOR_MAX_LENGTH)
|
||||
should validate_presence_of(:organization)
|
||||
|
||||
test "should validate with correct data" do
|
||||
|
|
|
@ -5,7 +5,7 @@ class SampleTypeTest < ActiveSupport::TestCase
|
|||
@sample_type = sample_types(:skin)
|
||||
end
|
||||
|
||||
should validate_length_of(:name).is_at_most(NAME_MAX_LENGTH)
|
||||
should validate_length_of(:name).is_at_most(Constants::NAME_MAX_LENGTH)
|
||||
should validate_presence_of(:name)
|
||||
should validate_presence_of(:organization)
|
||||
|
||||
|
|
|
@ -8,9 +8,10 @@ class UserTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
should validate_presence_of(:full_name)
|
||||
should validate_length_of(:full_name).is_at_most(NAME_MAX_LENGTH)
|
||||
should validate_length_of(:full_name).is_at_most(Constants::NAME_MAX_LENGTH)
|
||||
should validate_presence_of(:initials)
|
||||
should validate_length_of(:initials).is_at_most(USER_INITIALS_MAX_LENGTH)
|
||||
should validate_length_of(:initials)
|
||||
.is_at_most(Constants::USER_INITIALS_MAX_LENGTH)
|
||||
|
||||
# Test password attribute
|
||||
test "should have non-blank password" do
|
||||
|
|
Loading…
Reference in a new issue