Skip to content
Snippets Groups Projects
Commit 497a28c5 authored by Phil Hughes's avatar Phil Hughes
Browse files

Fixed project model tests

parent f2fb574d
No related branches found
No related tags found
1 merge request!4280Updated erorr message when project limit is zero
Pipeline #
...@@ -434,9 +434,9 @@ def check_limit ...@@ -434,9 +434,9 @@ def check_limit
projects_limit = creator.projects_limit projects_limit = creator.projects_limit
if projects_limit == 0 if projects_limit == 0
self.errors.add(:base, "Personal project creation is not allowed. Please contact your administrator with questions") self.errors.add(:limit_reached, "Personal project creation is not allowed. Please contact your administrator with questions")
else else
self.errors.add(:base, "Your project limit is #{projects_limit} projects! Please contact your administrator to increase it") self.errors.add(:limit_reached, "Your project limit is #{projects_limit} projects! Please contact your administrator to increase it")
end end
end end
rescue rescue
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
project2 = build(:project) project2 = build(:project)
allow(project2).to receive(:creator).and_return(double(can_create_project?: false, projects_limit: 0).as_null_object) allow(project2).to receive(:creator).and_return(double(can_create_project?: false, projects_limit: 0).as_null_object)
expect(project2).not_to be_valid expect(project2).not_to be_valid
expect(project2.errors[:limit_reached].first).to match(/Your project limit is 0/) expect(project2.errors[:limit_reached].first).to match(/Personal project creation is not allowed/)
end end
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment