Commit 497a28c5 authored by Phil Hughes's avatar Phil Hughes

Fixed project model tests

parent f2fb574d
...@@ -434,9 +434,9 @@ class Project < ActiveRecord::Base ...@@ -434,9 +434,9 @@ class Project < ActiveRecord::Base
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 @@ describe Project, models: true do ...@@ -60,7 +60,7 @@ describe Project, models: true do
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment