Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
2ad531f5
Commit
2ad531f5
authored
Oct 10, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Project::BoardLimitExcedeed error class
parent
c5ea58b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
app/models/project.rb
app/models/project.rb
+3
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+1
-1
No files found.
app/models/project.rb
View file @
2ad531f5
...
...
@@ -16,6 +16,8 @@ class Project < ActiveRecord::Base
extend
Gitlab
::
ConfigHelper
class
BoardLimitExceeded
<
StandardError
;
end
NUMBER_OF_PERMITTED_BOARDS
=
1
UNKNOWN_IMPORT_URL
=
'http://unknown.git'
...
...
@@ -1341,6 +1343,6 @@ class Project < ActiveRecord::Base
end
def
validate_board_limit
(
board
)
raise
StandardError
,
'Number of permitted boards exceeded'
if
boards
.
size
>=
NUMBER_OF_PERMITTED_BOARDS
raise
BoardLimitExceeded
,
'Number of permitted boards exceeded'
if
boards
.
size
>=
NUMBER_OF_PERMITTED_BOARDS
end
end
spec/models/project_spec.rb
View file @
2ad531f5
...
...
@@ -99,7 +99,7 @@ describe Project, models: true do
it
'raises an error when attempting to add more than one board to the project'
do
subject
.
boards
.
build
expect
{
subject
.
boards
.
build
}.
to
raise_error
(
StandardError
,
'Number of permitted boards exceeded'
)
expect
{
subject
.
boards
.
build
}.
to
raise_error
(
Project
::
BoardLimitExceeded
,
'Number of permitted boards exceeded'
)
expect
(
subject
.
boards
.
size
).
to
eq
1
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment