Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
04ca0b1a8629
Commit
04ca0b1a
authored
Oct 10, 2016
by
Douglas Barbosa Alexandre
Browse files
Add Project::BoardLimitExcedeed error class
parent
ebb4ca6580c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/models/project.rb
View file @
04ca0b1a
...
...
@@ -16,6 +16,8 @@
extend
Gitlab
::
ConfigHelper
class
BoardLimitExceeded
<
StandardError
;
end
NUMBER_OF_PERMITTED_BOARDS
=
1
UNKNOWN_IMPORT_URL
=
'http://unknown.git'
...
...
@@ -1341,6 +1343,6 @@
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 @
04ca0b1a
...
...
@@ -99,7 +99,7 @@
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
Supports
Markdown
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