Commit 2ad531f5 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre
Browse files

Add Project::BoardLimitExcedeed error class

parent ebb4ca6580c1
......@@ -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 @@ def authorized_for_user_by_shared_projects?(user, min_access_level)
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
......@@ -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
......
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