From 56293ad62d7a57abb9469c0875153402e6054f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Zrim=C5=A1ek?= Date: Mon, 17 Oct 2016 13:21:10 +0200 Subject: [PATCH] Added missing constants namespace to constants in test models. --- test/fixtures/user_organizations.yml | 3 +-- test/fixtures/user_projects.yml | 3 +-- test/models/checklist_item_test.rb | 2 +- test/models/checklist_test.rb | 2 +- test/models/comment_test.rb | 2 +- test/models/custom_field_test.rb | 2 +- test/models/experiment_test.rb | 6 +++--- test/models/my_module_group_test.rb | 2 +- test/models/my_module_test.rb | 4 ++-- test/models/organization_test.rb | 6 +++--- test/models/project_test.rb | 4 ++-- test/models/protocol_keyword_test.rb | 2 +- test/models/protocol_test.rb | 4 ++-- test/models/report_test.rb | 6 +++--- test/models/sample_group_test.rb | 4 ++-- test/models/sample_type_test.rb | 2 +- test/models/user_test.rb | 5 +++-- 17 files changed, 29 insertions(+), 30 deletions(-) diff --git a/test/fixtures/user_organizations.yml b/test/fixtures/user_organizations.yml index eea958c54..26642288b 100644 --- a/test/fixtures/user_organizations.yml +++ b/test/fixtures/user_organizations.yml @@ -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 - diff --git a/test/fixtures/user_projects.yml b/test/fixtures/user_projects.yml index e5ddc2c40..f2ea07074 100644 --- a/test/fixtures/user_projects.yml +++ b/test/fixtures/user_projects.yml @@ -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 - diff --git a/test/models/checklist_item_test.rb b/test/models/checklist_item_test.rb index d073dd052..f9c67489d 100644 --- a/test/models/checklist_item_test.rb +++ b/test/models/checklist_item_test.rb @@ -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( diff --git a/test/models/checklist_test.rb b/test/models/checklist_test.rb index 7f8c6b3e0..dfd23e2f2 100644 --- a/test/models/checklist_test.rb +++ b/test/models/checklist_test.rb @@ -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( diff --git a/test/models/comment_test.rb b/test/models/comment_test.rb index 96af081d1..53257f6ca 100644 --- a/test/models/comment_test.rb +++ b/test/models/comment_test.rb @@ -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? diff --git a/test/models/custom_field_test.rb b/test/models/custom_field_test.rb index d46e29f22..7e29dfd21 100644 --- a/test/models/custom_field_test.rb +++ b/test/models/custom_field_test.rb @@ -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', diff --git a/test/models/experiment_test.rb b/test/models/experiment_test.rb index 011c6aae0..278c3315e 100644 --- a/test/models/experiment_test.rb +++ b/test/models/experiment_test.rb @@ -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) diff --git a/test/models/my_module_group_test.rb b/test/models/my_module_group_test.rb index 0244d0010..21ee79a3b 100644 --- a/test/models/my_module_group_test.rb +++ b/test/models/my_module_group_test.rb @@ -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? diff --git a/test/models/my_module_test.rb b/test/models/my_module_test.rb index 488165590..77b82cb1b 100644 --- a/test/models/my_module_test.rb +++ b/test/models/my_module_test.rb @@ -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? diff --git a/test/models/organization_test.rb b/test/models/organization_test.rb index 671d32828..99595702b 100644 --- a/test/models/organization_test.rb +++ b/test/models/organization_test.rb @@ -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? diff --git a/test/models/project_test.rb b/test/models/project_test.rb index 8ac4d1e98..9774fd2f2 100644 --- a/test/models/project_test.rb +++ b/test/models/project_test.rb @@ -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 = "" diff --git a/test/models/protocol_keyword_test.rb b/test/models/protocol_keyword_test.rb index 6026994e0..bed05acb0 100644 --- a/test/models/protocol_keyword_test.rb +++ b/test/models/protocol_keyword_test.rb @@ -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 diff --git a/test/models/protocol_test.rb b/test/models/protocol_test.rb index 0d27495f5..3414cecd2 100644 --- a/test/models/protocol_test.rb +++ b/test/models/protocol_test.rb @@ -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 diff --git a/test/models/report_test.rb b/test/models/report_test.rb index 820243842..fb9b5e2d8 100644 --- a/test/models/report_test.rb +++ b/test/models/report_test.rb @@ -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" diff --git a/test/models/sample_group_test.rb b/test/models/sample_group_test.rb index cb0a8983a..1ace59756 100644 --- a/test/models/sample_group_test.rb +++ b/test/models/sample_group_test.rb @@ -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 diff --git a/test/models/sample_type_test.rb b/test/models/sample_type_test.rb index 80f42f83e..bd8963688 100644 --- a/test/models/sample_type_test.rb +++ b/test/models/sample_type_test.rb @@ -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) diff --git a/test/models/user_test.rb b/test/models/user_test.rb index bb795bd66..76a112e21 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -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