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-08-13 15:09:50 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-13 15:09:50 +0300
commit5605efec12c99adf88f641391cb879dedf8fa05e (patch)
tree4aea188ef160dec9346f0bcf61ecbe9cb7fa6661 /doc/development/ee_features.md
parent4e33606f0114c39e07f0151465299f75bfe00c3e (diff)
Add latest changes from gitlab-org/gitlab@masterfix-master-merge-train-helper
Diffstat (limited to 'doc/development/ee_features.md')
-rw-r--r--doc/development/ee_features.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/doc/development/ee_features.md b/doc/development/ee_features.md
index 3cbbf498db6..e7954fa910b 100644
--- a/doc/development/ee_features.md
+++ b/doc/development/ee_features.md
@@ -56,6 +56,12 @@ This works because for every path that is present in CE's eager-load/auto-load
paths, we add the same `ee/`-prepended path in [`config/application.rb`](https://gitlab.com/gitlab-org/gitlab/blob/925d3d4ebc7a2c72964ce97623ae41b8af12538d/config/application.rb#L42-52).
This also applies to views.
+#### Testing EE-only features
+
+To test an EE class that doesn't exist in CE, create the spec file as you normally
+would in the `ee/spec` directory, but without the second `ee/` subdirectory.
+For example, a class `ee/app/models/vulnerability.rb` would have its tests in `ee/spec/models/vulnerability_spec.rb`.
+
### EE features based on CE features
For features that build on existing CE features, write a module in the `EE`
@@ -96,6 +102,21 @@ This is also not just applied to models. Here's a list of other examples:
- `ee/app/validators/ee/foo_attr_validator.rb`
- `ee/app/workers/ee/foo_worker.rb`
+#### Testing EE features based on CE features
+
+To test an `EE` namespaced module that extends a CE class with EE features,
+create the spec file as you normally would in the `ee/spec` directory, including the second `ee/` subdirectory.
+For example, an extension `ee/app/models/ee/user.rb` would have its tests in `ee/app/models/ee/user_spec.rb`.
+
+In the `RSpec.describe` call, use the CE class name where the EE module would be used.
+For example, in `ee/app/models/ee/user_spec.rb`, the test would start with:
+
+```ruby
+RSpec.describe User do
+ describe 'ee feature added through extension'
+end
+```
+
#### Overriding CE methods
To override a method present in the CE codebase, use `prepend`. It