Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-04 00:08:37 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-04 00:08:37 +0300
commitbbaf2bb0438b1c71020d9d216feb528add225a7f (patch)
tree47409ddbb4994ec78c24503416ab44f129f39ec6 /doc/development/application_limits.md
parente9c2bf267862e22c0770cc7b3a1ed97a8b87a7fd (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/development/application_limits.md')
-rw-r--r--doc/development/application_limits.md20
1 files changed, 13 insertions, 7 deletions
diff --git a/doc/development/application_limits.md b/doc/development/application_limits.md
index c3bfe20dd87..dd07a9cbfb7 100644
--- a/doc/development/application_limits.md
+++ b/doc/development/application_limits.md
@@ -15,10 +15,6 @@ limits](https://about.gitlab.com/handbook/product/#introducing-application-limit
## Development
-The merge request to [configure maximum number of webhooks per
-project](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/20730/diffs) is a
-good example about configuring application limits.
-
### Insert database plan limits
In the `plan_limits` table, you have to create a new column and insert the
@@ -78,12 +74,22 @@ can be used to validate that a model does not exceed the limits. It ensures
that the count of the records for the current model does not exceed the defined
limit.
-NOTE: **Note:** The name (pluralized) of the plan limit introduced in the
-database (`project_hooks`) must correspond to the name of the model we are
-validating (`ProjectHook`).
+NOTE: **Note:** You must specify the limit scope of the object being validated
+and the limit name if it's different from the pluralized model name.
```ruby
class ProjectHook
include Limitable
+
+ self.limit_name = 'project_hooks' # Optional as ProjectHook corresponds with project_hooks
+ self.limit_scope = :project
+end
+```
+
+To test the model, you can include the shared examples.
+
+```ruby
+it_behaves_like 'includes Limitable concern' do
+ subject { build(:project_hook, project: create(:project)) }
end
```