Added missing constants namespace to constants in test models.

This commit is contained in:
Matej Zrimšek 2016-10-17 13:21:10 +02:00
parent a31753ea39
commit 56293ad62d
17 changed files with 29 additions and 30 deletions

View file

@ -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

View file

@ -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

View file

@ -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(

View file

@ -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(

View file

@ -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?

View file

@ -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',

View file

@ -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)

View file

@ -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?

View file

@ -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?

View file

@ -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?

View file

@ -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 = ""

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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

View file

@ -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)

View file

@ -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