diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-10-19 20:41:04 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-10-19 20:41:04 +0000 |
commit | 25ff16459c7e5b632278ee11a19a3930f91f44ec (patch) | |
tree | 6d8dd1416733c082c703e01ec17ee8ddbd764a99 /spec/factories | |
parent | dd06611df59100557a15f9b321ef81321fa102fa (diff) | |
parent | edef2d15f9f3b357074b73db3b26acc5b7ab2d5a (diff) | |
download | gitlab-ce-25ff16459c7e5b632278ee11a19a3930f91f44ec.tar.gz |
Merge branch 'feature/group-level-labels' into 'master'
Add group level labels
## What does this MR do?
Add group level labels.
## Are there points in the code the reviewer needs to double check?
* `LabelsFinder`
* `Gitlab::Gfm::ReferenceRewriter`
* `Banzai::Filter::LabelReferenceFilter`
## Why was this MR needed?
We'll be adding more feature that allow you to do cross-project management of issues.
## Screenshots (if relevant)
* Group Labels
![Group Labels](/uploads/2244c06ad68eae4fb246fb4c81bf8060/2.png)
* Project Labels
![Project Labels](/uploads/c5839516d2282b51f7418d9dadbeceb4/1.png)
* Expanded references for group labels when moving issue to another project
![Expanded references for group labels when moving issue to another project](/uploads/0c9ab248a8420d4978d59349ae3d42e5/3.png)
## Does this MR meet the acceptance criteria?
- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [x] API support added
- Tests
- [x] Added for this feature/bug
- [ ] All builds are passing
- [ ] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [ ] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
## What are the relevant issue numbers?
#19997
See merge request !6425
Diffstat (limited to 'spec/factories')
-rw-r--r-- | spec/factories/label_priorities.rb | 7 | ||||
-rw-r--r-- | spec/factories/labels.rb | 18 | ||||
-rw-r--r-- | spec/factories/merge_requests.rb | 10 |
3 files changed, 34 insertions, 1 deletions
diff --git a/spec/factories/label_priorities.rb b/spec/factories/label_priorities.rb new file mode 100644 index 00000000000..f25939d2d3e --- /dev/null +++ b/spec/factories/label_priorities.rb @@ -0,0 +1,7 @@ +FactoryGirl.define do + factory :label_priority do + project factory: :empty_project + label + sequence(:priority) + end +end diff --git a/spec/factories/labels.rb b/spec/factories/labels.rb index eb489099854..3e8822faf97 100644 --- a/spec/factories/labels.rb +++ b/spec/factories/labels.rb @@ -1,7 +1,23 @@ FactoryGirl.define do - factory :label do + factory :label, class: ProjectLabel do sequence(:title) { |n| "label#{n}" } color "#990000" project + + transient do + priority nil + end + + after(:create) do |label, evaluator| + if evaluator.priority + label.priorities.create(project: label.project, priority: evaluator.priority) + end + end + end + + factory :group_label, class: GroupLabel do + sequence(:title) { |n| "label#{n}" } + color "#990000" + group end end diff --git a/spec/factories/merge_requests.rb b/spec/factories/merge_requests.rb index c6a08d78b78..f780e01253c 100644 --- a/spec/factories/merge_requests.rb +++ b/spec/factories/merge_requests.rb @@ -68,5 +68,15 @@ FactoryGirl.define do factory :closed_merge_request, traits: [:closed] factory :reopened_merge_request, traits: [:reopened] factory :merge_request_with_diffs, traits: [:with_diffs] + + factory :labeled_merge_request do + transient do + labels [] + end + + after(:create) do |merge_request, evaluator| + merge_request.update_attributes(labels: evaluator.labels) + end + end end end |