From 948938797a5ad204960a56f0e80be9f372da36a0 Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Thu, 8 Feb 2018 11:50:54 +0000 Subject: Merge branch 'bvl-pot-merge-conflicts-docs' into 'master' Add a note about merge conflicts in `gitlab.pot` See merge request gitlab-org/gitlab-ce!16971 --- doc/development/i18n/externalization.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/development/i18n/externalization.md b/doc/development/i18n/externalization.md index f4542932295..c0a325a83e9 100644 --- a/doc/development/i18n/externalization.md +++ b/doc/development/i18n/externalization.md @@ -126,6 +126,9 @@ strings and remove any strings that aren't used anymore. You should check this file in. Once the changes are on master, they will be picked up by [Crowdin](http://translate.gitlab.com) and be presented for translation. +If there are merge conflicts in the `gitlab.pot` file, you can delete the file +and regenerate it using the same command. Confirm that you are not deleting any strings accidentally by looking over the diff. + The command also updates the translation files for each language: `locale/*/gitlab.po` These changes can be discarded, the languange files will be updated by Crowdin automatically. -- cgit v1.2.1 From 072b26196b5b4768c130ea0b9b4e8852fec379fc Mon Sep 17 00:00:00 2001 From: Marcia Ramos Date: Thu, 8 Feb 2018 15:26:50 +0000 Subject: Merge branch 'update-docs-labels-ce' into 'master' Update docs labels CE See merge request gitlab-org/gitlab-ce!16974 --- doc/user/project/img/label_priority_sort_order.png | Bin 101667 -> 0 bytes .../project/img/labels_assign_label_sidebar.png | Bin 11767 -> 0 bytes .../img/labels_assign_label_sidebar_saved.png | Bin 9741 -> 0 bytes doc/user/project/img/labels_default.png | Bin 24404 -> 22975 bytes .../project/img/labels_description_tooltip.png | Bin 8538 -> 0 bytes doc/user/project/img/labels_filter.png | Bin 19071 -> 0 bytes doc/user/project/img/labels_generate.png | Bin 13628 -> 0 bytes doc/user/project/img/labels_generate_default.png | Bin 0 -> 65549 bytes doc/user/project/img/labels_group_issues.png | Bin 0 -> 264573 bytes doc/user/project/img/labels_list.png | Bin 0 -> 207736 bytes doc/user/project/img/labels_new_label.png | Bin 10720 -> 0 bytes .../project/img/labels_new_label_on_the_fly.png | Bin 4625 -> 0 bytes .../img/labels_new_label_on_the_fly_create.png | Bin 6389 -> 0 bytes doc/user/project/img/labels_prioritize.png | Bin 24194 -> 0 bytes doc/user/project/img/labels_prioritized.png | Bin 0 -> 156020 bytes doc/user/project/img/labels_promotion.png | Bin 0 -> 121824 bytes doc/user/project/img/labels_sidebar.png | Bin 0 -> 31123 bytes doc/user/project/img/labels_sidebar_assign.png | Bin 0 -> 28033 bytes doc/user/project/img/labels_sidebar_inline.png | Bin 0 -> 28423 bytes .../project/img/labels_sort_label_priority.png | Bin 0 -> 110154 bytes doc/user/project/img/labels_sort_priority.png | Bin 0 -> 108780 bytes doc/user/project/img/labels_subscribe.png | Bin 5336 -> 0 bytes doc/user/project/img/labels_subscriptions.png | Bin 0 -> 87502 bytes doc/user/project/img/new_label_from_sidebar.gif | Bin 0 -> 759243 bytes doc/user/project/labels.md | 189 ++++++++------------- 25 files changed, 70 insertions(+), 119 deletions(-) delete mode 100644 doc/user/project/img/label_priority_sort_order.png delete mode 100644 doc/user/project/img/labels_assign_label_sidebar.png delete mode 100644 doc/user/project/img/labels_assign_label_sidebar_saved.png delete mode 100644 doc/user/project/img/labels_description_tooltip.png delete mode 100644 doc/user/project/img/labels_filter.png delete mode 100644 doc/user/project/img/labels_generate.png create mode 100644 doc/user/project/img/labels_generate_default.png create mode 100644 doc/user/project/img/labels_group_issues.png create mode 100644 doc/user/project/img/labels_list.png delete mode 100644 doc/user/project/img/labels_new_label.png delete mode 100644 doc/user/project/img/labels_new_label_on_the_fly.png delete mode 100644 doc/user/project/img/labels_new_label_on_the_fly_create.png delete mode 100644 doc/user/project/img/labels_prioritize.png create mode 100644 doc/user/project/img/labels_prioritized.png create mode 100644 doc/user/project/img/labels_promotion.png create mode 100644 doc/user/project/img/labels_sidebar.png create mode 100644 doc/user/project/img/labels_sidebar_assign.png create mode 100644 doc/user/project/img/labels_sidebar_inline.png create mode 100644 doc/user/project/img/labels_sort_label_priority.png create mode 100644 doc/user/project/img/labels_sort_priority.png delete mode 100644 doc/user/project/img/labels_subscribe.png create mode 100644 doc/user/project/img/labels_subscriptions.png create mode 100644 doc/user/project/img/new_label_from_sidebar.gif diff --git a/doc/user/project/img/label_priority_sort_order.png b/doc/user/project/img/label_priority_sort_order.png deleted file mode 100644 index 21c7a76a322..00000000000 Binary files a/doc/user/project/img/label_priority_sort_order.png and /dev/null differ diff --git a/doc/user/project/img/labels_assign_label_sidebar.png b/doc/user/project/img/labels_assign_label_sidebar.png deleted file mode 100644 index d74796fdb4d..00000000000 Binary files a/doc/user/project/img/labels_assign_label_sidebar.png and /dev/null differ diff --git a/doc/user/project/img/labels_assign_label_sidebar_saved.png b/doc/user/project/img/labels_assign_label_sidebar_saved.png deleted file mode 100644 index dabffe956dc..00000000000 Binary files a/doc/user/project/img/labels_assign_label_sidebar_saved.png and /dev/null differ diff --git a/doc/user/project/img/labels_default.png b/doc/user/project/img/labels_default.png index 7934e3bfb5e..7a7fab611a4 100644 Binary files a/doc/user/project/img/labels_default.png and b/doc/user/project/img/labels_default.png differ diff --git a/doc/user/project/img/labels_description_tooltip.png b/doc/user/project/img/labels_description_tooltip.png deleted file mode 100644 index eea4f8cf0f4..00000000000 Binary files a/doc/user/project/img/labels_description_tooltip.png and /dev/null differ diff --git a/doc/user/project/img/labels_filter.png b/doc/user/project/img/labels_filter.png deleted file mode 100644 index 6a1ebfc2ecb..00000000000 Binary files a/doc/user/project/img/labels_filter.png and /dev/null differ diff --git a/doc/user/project/img/labels_generate.png b/doc/user/project/img/labels_generate.png deleted file mode 100644 index 987f4b5be71..00000000000 Binary files a/doc/user/project/img/labels_generate.png and /dev/null differ diff --git a/doc/user/project/img/labels_generate_default.png b/doc/user/project/img/labels_generate_default.png new file mode 100644 index 00000000000..fca2a06e04f Binary files /dev/null and b/doc/user/project/img/labels_generate_default.png differ diff --git a/doc/user/project/img/labels_group_issues.png b/doc/user/project/img/labels_group_issues.png new file mode 100644 index 00000000000..29dcf7ff45e Binary files /dev/null and b/doc/user/project/img/labels_group_issues.png differ diff --git a/doc/user/project/img/labels_list.png b/doc/user/project/img/labels_list.png new file mode 100644 index 00000000000..12c47ea9766 Binary files /dev/null and b/doc/user/project/img/labels_list.png differ diff --git a/doc/user/project/img/labels_new_label.png b/doc/user/project/img/labels_new_label.png deleted file mode 100644 index e26425d0188..00000000000 Binary files a/doc/user/project/img/labels_new_label.png and /dev/null differ diff --git a/doc/user/project/img/labels_new_label_on_the_fly.png b/doc/user/project/img/labels_new_label_on_the_fly.png deleted file mode 100644 index 2ac9805b1ab..00000000000 Binary files a/doc/user/project/img/labels_new_label_on_the_fly.png and /dev/null differ diff --git a/doc/user/project/img/labels_new_label_on_the_fly_create.png b/doc/user/project/img/labels_new_label_on_the_fly_create.png deleted file mode 100644 index 02ccf68553b..00000000000 Binary files a/doc/user/project/img/labels_new_label_on_the_fly_create.png and /dev/null differ diff --git a/doc/user/project/img/labels_prioritize.png b/doc/user/project/img/labels_prioritize.png deleted file mode 100644 index d602a3c90ec..00000000000 Binary files a/doc/user/project/img/labels_prioritize.png and /dev/null differ diff --git a/doc/user/project/img/labels_prioritized.png b/doc/user/project/img/labels_prioritized.png new file mode 100644 index 00000000000..57dcfe89b3d Binary files /dev/null and b/doc/user/project/img/labels_prioritized.png differ diff --git a/doc/user/project/img/labels_promotion.png b/doc/user/project/img/labels_promotion.png new file mode 100644 index 00000000000..8a5efd210a2 Binary files /dev/null and b/doc/user/project/img/labels_promotion.png differ diff --git a/doc/user/project/img/labels_sidebar.png b/doc/user/project/img/labels_sidebar.png new file mode 100644 index 00000000000..7349c6d4f0c Binary files /dev/null and b/doc/user/project/img/labels_sidebar.png differ diff --git a/doc/user/project/img/labels_sidebar_assign.png b/doc/user/project/img/labels_sidebar_assign.png new file mode 100644 index 00000000000..61e8d04fc85 Binary files /dev/null and b/doc/user/project/img/labels_sidebar_assign.png differ diff --git a/doc/user/project/img/labels_sidebar_inline.png b/doc/user/project/img/labels_sidebar_inline.png new file mode 100644 index 00000000000..31fa397761d Binary files /dev/null and b/doc/user/project/img/labels_sidebar_inline.png differ diff --git a/doc/user/project/img/labels_sort_label_priority.png b/doc/user/project/img/labels_sort_label_priority.png new file mode 100644 index 00000000000..c8b97639121 Binary files /dev/null and b/doc/user/project/img/labels_sort_label_priority.png differ diff --git a/doc/user/project/img/labels_sort_priority.png b/doc/user/project/img/labels_sort_priority.png new file mode 100644 index 00000000000..a95198e7f72 Binary files /dev/null and b/doc/user/project/img/labels_sort_priority.png differ diff --git a/doc/user/project/img/labels_subscribe.png b/doc/user/project/img/labels_subscribe.png deleted file mode 100644 index 56f24ae7bc8..00000000000 Binary files a/doc/user/project/img/labels_subscribe.png and /dev/null differ diff --git a/doc/user/project/img/labels_subscriptions.png b/doc/user/project/img/labels_subscriptions.png new file mode 100644 index 00000000000..8bcb3b57f6c Binary files /dev/null and b/doc/user/project/img/labels_subscriptions.png differ diff --git a/doc/user/project/img/new_label_from_sidebar.gif b/doc/user/project/img/new_label_from_sidebar.gif new file mode 100644 index 00000000000..572b29a86e1 Binary files /dev/null and b/doc/user/project/img/new_label_from_sidebar.gif differ diff --git a/doc/user/project/labels.md b/doc/user/project/labels.md index d7eb4bca89c..49f7baf9652 100644 --- a/doc/user/project/labels.md +++ b/doc/user/project/labels.md @@ -1,174 +1,125 @@ # Labels -Labels provide an easy way to categorize the issues or merge requests based on -descriptive titles like `bug`, `documentation` or any other text you feel like. -They can have different colors, a description, and are visible throughout -the issue tracker or inside each issue individually. +## Overview -With labels, you can navigate the issue tracker and filter any bloated -information to visualize only the issues you are interested in. Let's see how -that works. +Labels allow you to categorize issues or merge requests using descriptive titles like `bug`, `feature request`, or `docs`. Each label also has a customizable color. They allow you to quickly and dynamically filter and manage issues or merge requests you care about, and are visible throughout GitLab in most places where issues and merge requests are located. -## Create new labels +## Project labels and group labels + +In GitLab, you can create project and group labels: + +- **Project labels** can be assigned to issues or merge requests in that project only. +- **Group labels** can be assigned to any issue or merge request of any project in that group. +- In the [future](https://gitlab.com/gitlab-org/gitlab-ce/issues/40915), you will be able to assign group labels to issues and merge reqeusts of projects in [subgroups](../group/subgroups/index.md). + +## Creating labels >**Note:** -A permission level of `Developer` or higher is required in order to manage -labels. +A permission level of `Developer` or higher is required in order to create labels. -Head over a single project and navigate to **Issues > Labels**. +### New project label -The first time you visit this page, you'll notice that there are no labels -created yet. +To create a **project label**, navigate to **Issues > Labels** in the project. -Creating a new label from scratch is as easy as pressing the **New label** -button. From there on you can choose the name, give it an optional description, -a color and you are set. +Click the **New label** button. Enter the title, an optional description, and the background color. Click **Create label** to create the label. -When you are ready press the **Create label** button to create the new label. +If a project has no labels, you can generate a default set of project labels from its empty label list page: -![New label](img/labels_new_label.png) +![Labels generate default](img/labels_generate_default.png) ---- +GitLab will add the following default labels to the project: -## Default labels +![Labels default](img/labels_default.png) -The very first time you visit the labels area, it's gonna be empty. In that -case, it's possible to populate the labels for your project from a set of -predefined labels. +### New group label -Click the link to 'Generate a default set of labels' and GitLab will -generate them for you. There are 8 default generated labels in total: +To create a **group label**, follow similar steps from above to project labels. Navigate to **Issues > Labels** in the group and create it from there. -- bug -- confirmed -- critical -- discussion -- documentation -- enhancement -- suggestion -- support +Group labels appear in every label list page of the group's child projects. -## Labels Overview +![Labels list](img/labels_list.png) -![Default generated labels](img/labels_default.png) +### New project label from sidebar -You can see that from the labels page you can have an overview of the number of -issues and merge requests assigned to each label. +From the sidebar of an issue or a merge request, you can create a create a new **project label** inline immediately, instead of navigating to the project label list page. -## Prioritize labels +![Labels inline](img/new_label_from_sidebar.gif) ->**Notes:** -> -> - Introduced in GitLab 8.9. -> - Priority sorting is based on the highest priority label only. This might -> change in the future, follow the discussion in -> https://gitlab.com/gitlab-org/gitlab-ce/issues/18554. +## Editing labels -Prioritized labels are like any other label, but sorted by priority. This allows -you to sort issues and merge requests by label priority. +NOTE: **Note:** +A permission level of `Developer` or higher is required in order to edit labels. -To prioritize labels, navigate to your project's **Issues > Labels** and click -on the star icon next to them to put them in the priority list. Click on the -star icon again to remove them from the list. +You can update a label by navigating to **Issues > Labels** in the project ot group and clicking the pencil icon. -From there, you can drag them around to set the desired priority. Priority is -set from high to low with an ascending order. Labels with no priority, count as -having their priority set to null. +You can delete a label by clicking the trash icon. -![Prioritize labels](img/labels_prioritize.png) +### Promoting project labels to group labels -Now that you have labels prioritized, you can use the 'Label priority' and 'Priority' -sort orders in the issues or merge requests tracker. +If you are expanding from a few projects to a larger number of projects within the same group, you may want to share the same label among multiple projects in the same group. If you previously created a project label and now want to make it available for other projects, you can promote it to a group label. -In the following, everything applies to both issues and merge requests, but we'll -refer to just issues for brevity. +From the project label list page, you can promote a project label to a group label. This will merge all project labels across all projects in this group with the same name into a single group label. All issues and merge requests that previously were assigned one of these project labels will now be assigned the new group label. This action cannot be reversed and the changes are permanent. -The 'Label priority' sort order positions issues with higher priority labels -toward the top, and issues with lower priority labels toward the bottom. A non-prioritized -label is considered to have the lowest priority. For a given issue, we _only_ consider the -highest priority label assigned to it in the comparison. ([We are discussing](https://gitlab.com/gitlab-org/gitlab-ce/issues/18554) -including all the labels in a given issue for this comparison.) Given two issues -are equal according to this sort comparison, their relative order is equal, and -therefore it's not guaranteed that one will be always above the other. +![Labels promotion](img/labels_promotion.png) -![Label priority sort order](img/label_priority_sort_order.png) +## Assigning labels from the sidebar -The 'Priority' sort order comparison first considers an issue's milestone's due date, -(if the issue is assigned a milestone and the milestone's due date exists), and then -secondarily considers the label priority comparison above. Sooner due dates results -a higher sort order. If an issue doesn't have a milestone due date, it is equivalent to -being assigned to a milestone that has a due date in the infinite future. Given two issues -are equal according to this two-stage sort comparison, their relative order is equal, and -therefore it's not guaranteed that one will be always above the other. +Every issue and merge request can be assigned any number of labels. The labels are visible on every issue and merge request page, in the sidebar. They are also visible in the issue board. From the sidebar, you can assign or unassign a label to the object (i.e. label or unlabel it). You can also perform this as a [quick action](quick_actions.md) in a comment. -![Priority sort order](img/priority_sort_order.png) +| View labels in sidebar | Assign labels from sidebar | +|:---:|:---:| +| ![Labels sidebar](img/labels_sidebar.png) | ![Labels sidebar assign](img/labels_sidebar_assign.png) | +## Filtering issues and merge requests by label -## Subscribe to labels +### Filtering in list pages -If you don’t want to miss issues or merge requests that are important to you, -simply subscribe to a label. You’ll get notified whenever the label gets added -to an issue or merge request, making sure you don’t miss a thing. +From the project issue list page and the project merge request list page, you can [filter](../search/index.md#issues-and-merge-requests) by both group labels and project labels. -Go to your project's **Issues > Labels** area, find the label(s) you want to -subscribe to and click on the eye icon. Click again to unsubscribe. +From the group issue list page and the group merge request list page, you can [filter](../search/index.md#issues-and-merge-requests) by both group labels and project labels. -![Subscribe to labels](img/labels_subscribe.png) +![Labels group issues](img/labels_group_issues.png) -If you work on a large or popular project, try subscribing only to the labels -that are relevant to you. You’ll notice it’ll be much easier to focus on what’s -important. +### Filtering in issue boards -## Create a new label when inside an issue +- From [project boards](issue_board.md), you can filter by both group labels and project labels in the [search and filter bar](../search/index.md#issue-boards). -There are times when you are already inside an issue searching to assign a -label, only to realize it doesn't exist. Instead of going to the **Labels** -page and being distracted from your original purpose, you can create new -labels on the fly. +## Subscribing to labels -Expand the issue sidebar and select **Create new label** from the labels dropdown -list. Provide a name, pick a color and hit **Create**. The new label will be -ready to used right away! +From the project label list page and the group label list page, you can subscribe to [notifications](../../workflow/notifications.md) of a given label, to alert you that that label has been assigned to an issue or merge request. -![New label on the fly](img/labels_new_label_on_the_fly.png) +![Labels subscriptions](img/labels_subscriptions.png) -## Assigning labels to issues and merge requests +## Label priority -There are generally two ways to assign a label to an issue or merge request. +>**Notes:** +> +> - Introduced in GitLab 8.9. +> - Priority sorting is based on the highest priority label only. [This discussion](https://gitlab.com/gitlab-org/gitlab-ce/issues/18554) considers changing this. -The first one is to assign a label when you first create or edit an issue or -merge request. +Labels can have relative priorities, which are used in the "Label priority" and "Priority" sort orders of the issue and merge request list pages. -The second way is by using the right sidebar when inside an issue or merge -request. Expand it and hit **Edit** in the labels area. Start typing the name -of the label you are looking for to narrow down the list, and select it. You -can add more than one labels at once. When done, click outside the sidebar area -for the changes to take effect. +From the project label list page, star a label to indicate that it has a priority. Drag starred labels up and down to change their priority. Higher means higher priority. Prioritization happens at the project level, only on the project label list page, and not on the group label list page. However, both project and group labels can be prioritized on the project label list page since both types are displayed on the project label list page. -![Assign label in sidebar](img/labels_assign_label_sidebar.png) -![Save labels in sidebar](img/labels_assign_label_sidebar_saved.png) +![Labels prioritized](img/labels_prioritized.png) ---- +On the project and group issue and merge request list pages, you can sort by `Label priority` and `Priority`, which account for objects (issues and merge requests) that have prioritized labels assigned to them. -To remove labels, expand the left sidebar and unmark them from the labels list. -Simple as that. +If you sort by `Label priority`, GitLab considers this sort comparison order: -## Use labels to filter issues +- Object with a higher priority prioritized label. +- Object without a prioritized label. -Once you start adding labels to your issues, you'll see the benefit of it. -Labels can have several uses, one of them being the quick filtering of issues -or merge requests. +Ties are broken arbitrarily. (Note that we _only_ consider the highest prioritized label in an object, and not any of the lower prioritized labels. [This discussion](https://gitlab.com/gitlab-org/gitlab-ce/issues/18554) considers changing this.) -Pick an existing label from the dropdown _Label_ menu or click on an existing -label from the issue tracker. In the latter case, you also get to see the -label description like shown below. +![Labels sort label priority](img/labels_sort_label_priority.png) -![Filter labels](img/labels_filter.png) +If you sort by `Priority`, GitLab considers this sort comparison order: ---- +- Object's assigned [milestone](milestones/index.md)'s due date is sooner, provided the object has a milestone and the milestone has a due date. If this isn't the case, consider the object having a due date in the infinite future. +- Object with a higher priority prioritized label. +- Object without a prioritized label. -And if you added a description to your label, you can see it by hovering your -mouse over the label in the issue tracker or wherever else the label is -rendered. +Ties are broken arbitrarily. -![Label tooltips](img/labels_description_tooltip.png) +![Labels sort priority](img/labels_sort_priority.png) -- cgit v1.2.1 From 466d93d663519e02fbc8cd3ff4b66c97c73e94c5 Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Thu, 8 Feb 2018 15:46:33 +0000 Subject: Merge branch 'issues-in-subgroups' into 'master' Issues and merge requests in subgroups docs See merge request gitlab-org/gitlab-ce!16978 --- doc/user/project/issues/index.md | 4 +--- doc/user/project/merge_requests/index.md | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/doc/user/project/issues/index.md b/doc/user/project/issues/index.md index 88acd8edbe2..be4436749f9 100644 --- a/doc/user/project/issues/index.md +++ b/doc/user/project/issues/index.md @@ -64,9 +64,7 @@ You can also [search and filter](../../search/index.md#issues-and-merge-requests ### Issues per group -View all the issues in a group (that is, all the issues across all projects in that -group) by navigating to **Group > Issues**. This view also has the open and closed -issue tabs. +View issues in all projects in the group, including all projects of all descendant subgroups of the group. Navigate to **Group > Issues** to view these issues. This view also has the open and closed issues tabs. ![Group Issues list view](img/group_issues_list_view.png) diff --git a/doc/user/project/merge_requests/index.md b/doc/user/project/merge_requests/index.md index aa3266cb457..1658307ef81 100644 --- a/doc/user/project/merge_requests/index.md +++ b/doc/user/project/merge_requests/index.md @@ -70,9 +70,9 @@ and you can use the tabs available to quickly filter by open and closed. You can ## Merge requests per group -View all the merge requests in a group (that is, all the merge requests across all projects in that -group) by navigating to **Group > Merge Requests**. This view also has the open, merged, and closed -merge request tabs, from which you can [search and filter the results](../../search/index.md#issues-and-merge-requests-per-group). +View merge requests in all projects in the group, including all projects of all descendant subgroups of the group. Navigate to **Group > Merge Requests** to view these merge requests. This view also has the open and closed merge requests tabs. + +You can [search and filter the results](../../search/index.md#issues-and-merge-requests-per-group) from here. ![Group Issues list view](img/group_merge_requests_list_view.png) -- cgit v1.2.1 From 23501137a6b15acd70fceda20267b8db1cde89b5 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Thu, 8 Feb 2018 11:22:04 +0000 Subject: Merge branch 'bvl-fix-concurrent-fork-network-migrations' into 'master' Fix concurrent fork network migrations Closes #41487 See merge request gitlab-org/gitlab-ce!16988 --- .../bvl-fix-concurrent-fork-network-migrations.yml | 5 +++++ db/migrate/20170929131201_populate_fork_networks.rb | 16 +--------------- .../20171124150326_reschedule_fork_network_creation.rb | 16 +--------------- doc/development/background_migrations.md | 12 ++++++++++++ .../create_fork_network_memberships_range.rb | 15 +++++++++++---- 5 files changed, 30 insertions(+), 34 deletions(-) create mode 100644 changelogs/unreleased/bvl-fix-concurrent-fork-network-migrations.yml diff --git a/changelogs/unreleased/bvl-fix-concurrent-fork-network-migrations.yml b/changelogs/unreleased/bvl-fix-concurrent-fork-network-migrations.yml new file mode 100644 index 00000000000..b2a77f75e55 --- /dev/null +++ b/changelogs/unreleased/bvl-fix-concurrent-fork-network-migrations.yml @@ -0,0 +1,5 @@ +--- +title: Avoid running `PopulateForkNetworksRange`-migration multiple times +merge_request: 16988 +author: +type: fixed diff --git a/db/migrate/20170929131201_populate_fork_networks.rb b/db/migrate/20170929131201_populate_fork_networks.rb index 1214962770f..ddbf27e1852 100644 --- a/db/migrate/20170929131201_populate_fork_networks.rb +++ b/db/migrate/20170929131201_populate_fork_networks.rb @@ -6,22 +6,8 @@ class PopulateForkNetworks < ActiveRecord::Migration DOWNTIME = false - MIGRATION = 'PopulateForkNetworksRange'.freeze - BATCH_SIZE = 100 - DELAY_INTERVAL = 15.seconds - - disable_ddl_transaction! - - class ForkedProjectLink < ActiveRecord::Base - include EachBatch - - self.table_name = 'forked_project_links' - end - def up - say 'Populating the `fork_networks` based on existing `forked_project_links`' - - queue_background_migration_jobs_by_range_at_intervals(ForkedProjectLink, MIGRATION, DELAY_INTERVAL, batch_size: BATCH_SIZE) + say 'Fork networks will be populated in 20171205190711 - RescheduleForkNetworkCreationCaller' end def down diff --git a/db/post_migrate/20171124150326_reschedule_fork_network_creation.rb b/db/post_migrate/20171124150326_reschedule_fork_network_creation.rb index 05430efe1f6..26f917d5a1e 100644 --- a/db/post_migrate/20171124150326_reschedule_fork_network_creation.rb +++ b/db/post_migrate/20171124150326_reschedule_fork_network_creation.rb @@ -3,22 +3,8 @@ class RescheduleForkNetworkCreation < ActiveRecord::Migration DOWNTIME = false - MIGRATION = 'PopulateForkNetworksRange'.freeze - BATCH_SIZE = 100 - DELAY_INTERVAL = 15.seconds - - disable_ddl_transaction! - - class ForkedProjectLink < ActiveRecord::Base - include EachBatch - - self.table_name = 'forked_project_links' - end - def up - say 'Populating the `fork_networks` based on existing `forked_project_links`' - - queue_background_migration_jobs_by_range_at_intervals(ForkedProjectLink, MIGRATION, DELAY_INTERVAL, batch_size: BATCH_SIZE) + say 'Fork networks will be populated in 20171205190711 - RescheduleForkNetworkCreationCaller' end def down diff --git a/doc/development/background_migrations.md b/doc/development/background_migrations.md index af2026c483e..fc1b202b5eb 100644 --- a/doc/development/background_migrations.md +++ b/doc/development/background_migrations.md @@ -94,6 +94,18 @@ jobs = [['BackgroundMigrationClassName', [1]], BackgroundMigrationWorker.bulk_perform_in(5.minutes, jobs) ``` +### Rescheduling background migrations + +If one of the background migrations contains a bug that is fixed in a patch +release, the background migration needs to be rescheduled so the migration would +be repeated on systems that already performed the initial migration. + +When you reschedule the background migration, make sure to turn the original +scheduling into a no-op by clearing up the `#up` and `#down` methods of the +migration performing the scheduling. Otherwise the background migration would be +scheduled multiple times on systems that are upgrading multiple patch releases at +once. + ## Cleaning Up >**Note:** diff --git a/lib/gitlab/background_migration/create_fork_network_memberships_range.rb b/lib/gitlab/background_migration/create_fork_network_memberships_range.rb index 03b17b319fa..1b4a9e8a194 100644 --- a/lib/gitlab/background_migration/create_fork_network_memberships_range.rb +++ b/lib/gitlab/background_migration/create_fork_network_memberships_range.rb @@ -14,6 +14,14 @@ module Gitlab def perform(start_id, end_id) log("Creating memberships for forks: #{start_id} - #{end_id}") + insert_members(start_id, end_id) + + if missing_members?(start_id, end_id) + BackgroundMigrationWorker.perform_in(RESCHEDULE_DELAY, "CreateForkNetworkMembershipsRange", [start_id, end_id]) + end + end + + def insert_members(start_id, end_id) ActiveRecord::Base.connection.execute <<~INSERT_MEMBERS INSERT INTO fork_network_members (fork_network_id, project_id, forked_from_project_id) @@ -33,10 +41,9 @@ module Gitlab WHERE existing_members.project_id = forked_project_links.forked_to_project_id ) INSERT_MEMBERS - - if missing_members?(start_id, end_id) - BackgroundMigrationWorker.perform_in(RESCHEDULE_DELAY, "CreateForkNetworkMembershipsRange", [start_id, end_id]) - end + rescue ActiveRecord::RecordNotUnique => e + # `fork_network_member` was created concurrently in another migration + log(e.message) end def missing_members?(start_id, end_id) -- cgit v1.2.1 From c2b09a648542017cb54d35924e47217c42de6cb8 Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Thu, 8 Feb 2018 15:54:48 +0000 Subject: Merge branch 'docs-for-commits-linking-to-mrs' into 'master' Add docs for MR link in commit page See merge request gitlab-org/gitlab-ce!16994 --- doc/user/project/merge_requests/index.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/doc/user/project/merge_requests/index.md b/doc/user/project/merge_requests/index.md index 1658307ef81..0de89f90e21 100644 --- a/doc/user/project/merge_requests/index.md +++ b/doc/user/project/merge_requests/index.md @@ -146,6 +146,19 @@ administrator to do so. ![Create new merge requests by email](img/create_from_email.png) +## Find the merge request that introduced a change + +> **Note**: this feature was [implemented in GitLab 10.5](https://gitlab.com/gitlab-org/gitlab-ce/issues/2383). + +When viewing the commit details page, GitLab will link to the merge request (or +merge requests, if it's in more than one) containing that commit. + +This only applies to commits that are in the most recent version of a merge +request - if a commit was in a merge request, then rebased out of that merge +request, they will not be linked. + +[Read more about merge request versions](versions.md) + ## Revert changes GitLab implements Git's powerful feature to revert any commit with introducing @@ -160,7 +173,7 @@ of merge request diff is created. When you visit a merge request that contains more than one pushes, you can select and compare the versions of those merge request diffs. -[Read more about the merge requests versions.](versions.md) +[Read more about merge request versions](versions.md) ## Work In Progress merge requests -- cgit v1.2.1 From 676602a98ebf7817cefd1ba0e925530efc91d005 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Thu, 8 Feb 2018 15:52:32 +0000 Subject: Merge branch '180-qa-fix-api-spec' into 'master' Resolve 10.5.0 RC1 QA Failure with failing API specs Closes gitlab-qa#180 See merge request gitlab-org/gitlab-ce!16999 --- qa/qa/specs/features/api/users_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qa/qa/specs/features/api/users_spec.rb b/qa/qa/specs/features/api/users_spec.rb index 9d039590a0e..d4ff4ebbc9a 100644 --- a/qa/qa/specs/features/api/users_spec.rb +++ b/qa/qa/specs/features/api/users_spec.rb @@ -14,7 +14,7 @@ module QA end scenario 'submit request with a valid user name' do - get request.url, { params: { username: 'root' } } + get request.url, { params: { username: Runtime::User.name } } expect_status(200) expect(json_body).to be_an Array @@ -23,7 +23,7 @@ module QA end scenario 'submit request with an invalid user name' do - get request.url, { params: { username: 'invalid' } } + get request.url, { params: { username: SecureRandom.hex(10) } } expect_status(200) expect(json_body).to be_an Array -- cgit v1.2.1 From 3d40deb1b01cd856b3e7ab7b00fa0f3a6af0de58 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Mon, 12 Feb 2018 08:45:54 +0000 Subject: Merge branch '42937-search-api-fix' into 'master' API - fix searching in group/project specified by path Closes #42937 See merge request gitlab-org/gitlab-ce!17033 --- lib/api/search.rb | 8 ++++---- spec/requests/api/search_spec.rb | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/lib/api/search.rb b/lib/api/search.rb index 9f08fd96a3b..b9982e03bb3 100644 --- a/lib/api/search.rb +++ b/lib/api/search.rb @@ -85,9 +85,9 @@ module API use :pagination end get ':id/-/search' do - find_group!(params[:id]) + group = find_group!(params[:id]) - present search(group_id: params[:id]), with: entity + present search(group_id: group.id), with: entity end end @@ -106,9 +106,9 @@ module API use :pagination end get ':id/-/search' do - find_project!(params[:id]) + project = find_project!(params[:id]) - present search(project_id: params[:id]), with: entity + present search(project_id: project.id), with: entity end end end diff --git a/spec/requests/api/search_spec.rb b/spec/requests/api/search_spec.rb index a0026c6e11c..ddda5752f0c 100644 --- a/spec/requests/api/search_spec.rb +++ b/spec/requests/api/search_spec.rb @@ -180,6 +180,18 @@ describe API::Search do it_behaves_like 'response is correct', schema: 'public_api/v4/milestones' end + + context 'for milestones scope with group path as id' do + before do + another_project = create(:project, :public) + create(:milestone, project: project, title: 'awesome milestone') + create(:milestone, project: another_project, title: 'awesome milestone other project') + + get api("/groups/#{CGI.escape(group.full_path)}/-/search", user), scope: 'milestones', search: 'awesome' + end + + it_behaves_like 'response is correct', schema: 'public_api/v4/milestones' + end end end @@ -286,6 +298,14 @@ describe API::Search do it_behaves_like 'response is correct', schema: 'public_api/v4/commits' end + context 'for commits scope with project path as id' do + before do + get api("/projects/#{CGI.escape(repo_project.full_path)}/-/search", user), scope: 'commits', search: '498214de67004b1da3d820901307bed2a68a8ef6' + end + + it_behaves_like 'response is correct', schema: 'public_api/v4/commits' + end + context 'for blobs scope' do before do get api("/projects/#{repo_project.id}/-/search", user), scope: 'blobs', search: 'monitors' -- cgit v1.2.1 From 769f732111a4479e540eeb61eff9f609fb683a2d Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Mon, 12 Feb 2018 10:02:37 +0000 Subject: Merge branch '42928-default-protected-variables-to-off' into 'master' Default CI variables to unprotected Closes #42928 See merge request gitlab-org/gitlab-ce!17039 --- app/assets/javascripts/ci_variable_list/ci_variable_list.js | 2 +- app/views/ci/variables/_variable_row.html.haml | 2 +- spec/javascripts/ci_variable_list/ci_variable_list_spec.js | 2 +- spec/support/features/variable_list_shared_examples.rb | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/ci_variable_list/ci_variable_list.js b/app/assets/javascripts/ci_variable_list/ci_variable_list.js index d91789c2192..3467e88119b 100644 --- a/app/assets/javascripts/ci_variable_list/ci_variable_list.js +++ b/app/assets/javascripts/ci_variable_list/ci_variable_list.js @@ -39,7 +39,7 @@ export default class VariableList { }, protected: { selector: '.js-ci-variable-input-protected', - default: 'true', + default: 'false', }, environment_scope: { // We can't use a `.js-` class here because diff --git a/app/views/ci/variables/_variable_row.html.haml b/app/views/ci/variables/_variable_row.html.haml index 495a55660cb..15201780451 100644 --- a/app/views/ci/variables/_variable_row.html.haml +++ b/app/views/ci/variables/_variable_row.html.haml @@ -5,7 +5,7 @@ - id = variable&.id - key = variable&.key - value = variable&.value -- is_protected = variable && !only_key_value ? variable.protected : true +- is_protected = variable && !only_key_value ? variable.protected : false - id_input_name = "#{form_field}[variables_attributes][][id]" - destroy_input_name = "#{form_field}[variables_attributes][][_destroy]" diff --git a/spec/javascripts/ci_variable_list/ci_variable_list_spec.js b/spec/javascripts/ci_variable_list/ci_variable_list_spec.js index 6ab7b50e035..8acb346901f 100644 --- a/spec/javascripts/ci_variable_list/ci_variable_list_spec.js +++ b/spec/javascripts/ci_variable_list/ci_variable_list_spec.js @@ -126,7 +126,7 @@ describe('VariableList', () => { // Check for the correct default in the new row const $protectedInput = $wrapper.find('.js-row:last-child').find('.js-ci-variable-input-protected'); - expect($protectedInput.val()).toBe('true'); + expect($protectedInput.val()).toBe('false'); }) .then(done) .catch(done.fail); diff --git a/spec/support/features/variable_list_shared_examples.rb b/spec/support/features/variable_list_shared_examples.rb index 83bf06b6727..4315bf5d037 100644 --- a/spec/support/features/variable_list_shared_examples.rb +++ b/spec/support/features/variable_list_shared_examples.rb @@ -41,13 +41,13 @@ shared_examples 'variable list' do end end - it 'adds new unprotected variable' do + it 'adds new protected variable' do page.within('.js-ci-variable-list-section .js-row:last-child') do find('.js-ci-variable-input-key').set('key') find('.js-ci-variable-input-value').set('key value') find('.ci-variable-protected-item .js-project-feature-toggle').click - expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('false') + expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('true') end click_button('Save variables') @@ -59,7 +59,7 @@ shared_examples 'variable list' do page.within('.js-ci-variable-list-section .js-row:nth-child(1)') do expect(find('.js-ci-variable-input-key').value).to eq('key') expect(find('.js-ci-variable-input-value', visible: false).value).to eq('key value') - expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('false') + expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('true') end end @@ -143,7 +143,6 @@ shared_examples 'variable list' do page.within('.js-ci-variable-list-section .js-row:last-child') do find('.js-ci-variable-input-key').set('unprotected_key') find('.js-ci-variable-input-value').set('unprotected_value') - find('.ci-variable-protected-item .js-project-feature-toggle').click expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('false') end @@ -178,6 +177,7 @@ shared_examples 'variable list' do page.within('.js-ci-variable-list-section .js-row:last-child') do find('.js-ci-variable-input-key').set('protected_key') find('.js-ci-variable-input-value').set('protected_value') + find('.ci-variable-protected-item .js-project-feature-toggle').click expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('true') end -- cgit v1.2.1 From e607fd796657afd214b8f25201919d3e33b3f35f Mon Sep 17 00:00:00 2001 From: Ian Baum Date: Mon, 12 Feb 2018 19:05:31 +0000 Subject: Merge branch 'rd-43185-revert-sanitize-extra-blank-spaces-used-when-uploading-a-ssh-key' into 'master' Revert "Merge branch 'rd-40552-gitlab-should-check-if-keys-are-valid-before-saving' into 'master'" See merge request gitlab-org/gitlab-ce!17062 --- app/models/key.rb | 7 +-- ...-blank-spaces-used-when-uploading-a-ssh-key.yml | 5 --- lib/gitlab/ssh_public_key.rb | 28 +++--------- spec/factories/keys.rb | 4 -- spec/lib/gitlab/ssh_public_key_spec.rb | 35 --------------- spec/models/key_spec.rb | 51 +++------------------- 6 files changed, 17 insertions(+), 113 deletions(-) delete mode 100644 changelogs/unreleased/40552-sanitize-extra-blank-spaces-used-when-uploading-a-ssh-key.yml diff --git a/app/models/key.rb b/app/models/key.rb index ae5769c0627..7406c98c99e 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -33,8 +33,9 @@ class Key < ActiveRecord::Base after_destroy :refresh_user_cache def key=(value) - write_attribute(:key, value.present? ? Gitlab::SSHPublicKey.sanitize(value) : nil) - + value&.delete!("\n\r") + value.strip! unless value.blank? + write_attribute(:key, value) @public_key = nil end @@ -96,7 +97,7 @@ class Key < ActiveRecord::Base def generate_fingerprint self.fingerprint = nil - return unless public_key.valid? + return unless self.key.present? self.fingerprint = public_key.fingerprint end diff --git a/changelogs/unreleased/40552-sanitize-extra-blank-spaces-used-when-uploading-a-ssh-key.yml b/changelogs/unreleased/40552-sanitize-extra-blank-spaces-used-when-uploading-a-ssh-key.yml deleted file mode 100644 index 9e4811ca308..00000000000 --- a/changelogs/unreleased/40552-sanitize-extra-blank-spaces-used-when-uploading-a-ssh-key.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Sanitize extra blank spaces used when uploading a SSH key -merge_request: 40552 -author: -type: fixed diff --git a/lib/gitlab/ssh_public_key.rb b/lib/gitlab/ssh_public_key.rb index 545e7c74f7e..89ca1298120 100644 --- a/lib/gitlab/ssh_public_key.rb +++ b/lib/gitlab/ssh_public_key.rb @@ -21,22 +21,6 @@ module Gitlab technology(name)&.supported_sizes end - def self.sanitize(key_content) - ssh_type, *parts = key_content.strip.split - - return key_content if parts.empty? - - parts.each_with_object("#{ssh_type} ").with_index do |(part, content), index| - content << part - - if Gitlab::SSHPublicKey.new(content).valid? - break [content, parts[index + 1]].compact.join(' ') # Add the comment part if present - elsif parts.size == index + 1 # return original content if we've reached the last element - break key_content - end - end - end - attr_reader :key_text, :key # Unqualified MD5 fingerprint for compatibility @@ -53,23 +37,23 @@ module Gitlab end def valid? - key.present? && bits && technology.supported_sizes.include?(bits) + key.present? end def type - technology.name if key.present? + technology.name if valid? end def bits - return if key.blank? + return unless valid? case type when :rsa - key.n&.num_bits + key.n.num_bits when :dsa - key.p&.num_bits + key.p.num_bits when :ecdsa - key.group.order&.num_bits + key.group.order.num_bits when :ed25519 256 else diff --git a/spec/factories/keys.rb b/spec/factories/keys.rb index 23a98a899f1..f0c43f3d6f5 100644 --- a/spec/factories/keys.rb +++ b/spec/factories/keys.rb @@ -5,10 +5,6 @@ FactoryBot.define do title key { Spec::Support::Helpers::KeyGeneratorHelper.new(1024).generate + ' dummy@gitlab.com' } - factory :key_without_comment do - key { Spec::Support::Helpers::KeyGeneratorHelper.new(1024).generate } - end - factory :deploy_key, class: 'DeployKey' factory :personal_key do diff --git a/spec/lib/gitlab/ssh_public_key_spec.rb b/spec/lib/gitlab/ssh_public_key_spec.rb index c15e29774b6..93d538141ce 100644 --- a/spec/lib/gitlab/ssh_public_key_spec.rb +++ b/spec/lib/gitlab/ssh_public_key_spec.rb @@ -37,41 +37,6 @@ describe Gitlab::SSHPublicKey, lib: true do end end - describe '.sanitize(key_content)' do - let(:content) { build(:key).key } - - context 'when key has blank space characters' do - it 'removes the extra blank space characters' do - unsanitized = content.insert(100, "\n") - .insert(40, "\r\n") - .insert(30, ' ') - - sanitized = described_class.sanitize(unsanitized) - _, body = sanitized.split - - expect(sanitized).not_to eq(unsanitized) - expect(body).not_to match(/\s/) - end - end - - context "when key doesn't have blank space characters" do - it "doesn't modify the content" do - sanitized = described_class.sanitize(content) - - expect(sanitized).to eq(content) - end - end - - context "when key is invalid" do - it 'returns the original content' do - unsanitized = "ssh-foo any content==" - sanitized = described_class.sanitize(unsanitized) - - expect(sanitized).to eq(unsanitized) - end - end - end - describe '#valid?' do subject { public_key } diff --git a/spec/models/key_spec.rb b/spec/models/key_spec.rb index bf5703ac986..7398fd25aa8 100644 --- a/spec/models/key_spec.rb +++ b/spec/models/key_spec.rb @@ -72,52 +72,15 @@ describe Key, :mailer do expect(build(:key)).to be_valid end - it 'rejects the unfingerprintable key (not a key)' do - expect(build(:key, key: 'ssh-rsa an-invalid-key==')).not_to be_valid - end - - where(:factory, :chars, :expected_sections) do - [ - [:key, ["\n", "\r\n"], 3], - [:key, [' ', ' '], 3], - [:key_without_comment, [' ', ' '], 2] - ] - end - - with_them do - let!(:key) { create(factory) } - let!(:original_fingerprint) { key.fingerprint } - - it 'accepts a key with blank space characters after stripping them' do - modified_key = key.key.insert(100, chars.first).insert(40, chars.last) - _, content = modified_key.split - - key.update!(key: modified_key) - - expect(key).to be_valid - expect(key.key.split.size).to eq(expected_sections) - - expect(content).not_to match(/\s/) - expect(original_fingerprint).to eq(key.fingerprint) - end - end - end - - context 'validate size' do - where(:key_content, :result) do - [ - [Spec::Support::Helpers::KeyGeneratorHelper.new(512).generate, false], - [Spec::Support::Helpers::KeyGeneratorHelper.new(8192).generate, false], - [Spec::Support::Helpers::KeyGeneratorHelper.new(1024).generate, true] - ] + it 'accepts a key with newline charecters after stripping them' do + key = build(:key) + key.key = key.key.insert(100, "\n") + key.key = key.key.insert(40, "\r\n") + expect(key).to be_valid end - with_them do - it 'validates the size of the key' do - key = build(:key, key: key_content) - - expect(key.valid?).to eq(result) - end + it 'rejects the unfingerprintable key (not a key)' do + expect(build(:key, key: 'ssh-rsa an-invalid-key==')).not_to be_valid end end -- cgit v1.2.1 From 47b750a4f9384d95a1266292e162334fc0b80cbd Mon Sep 17 00:00:00 2001 From: Ian Baum Date: Mon, 12 Feb 2018 20:21:32 +0000 Subject: Merge branch 'sh-disable-query-limiter' into 'master' Disable query limiting warnings for now on GitLab.com See merge request gitlab-org/gitlab-ce!17067 --- lib/gitlab/query_limiting.rb | 2 +- spec/lib/gitlab/query_limiting_spec.rb | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/gitlab/query_limiting.rb b/lib/gitlab/query_limiting.rb index f64f1757144..9f69a9e4a39 100644 --- a/lib/gitlab/query_limiting.rb +++ b/lib/gitlab/query_limiting.rb @@ -6,7 +6,7 @@ module Gitlab # This ensures we don't produce any errors that users can't do anything # about themselves. def self.enable? - Gitlab.com? || Rails.env.development? || Rails.env.test? + Rails.env.development? || Rails.env.test? end # Allows the current request to execute any number of SQL queries. diff --git a/spec/lib/gitlab/query_limiting_spec.rb b/spec/lib/gitlab/query_limiting_spec.rb index 2eddab0b8c3..42877b1e2dd 100644 --- a/spec/lib/gitlab/query_limiting_spec.rb +++ b/spec/lib/gitlab/query_limiting_spec.rb @@ -12,14 +12,16 @@ describe Gitlab::QueryLimiting do expect(described_class.enable?).to eq(true) end - it 'returns true on GitLab.com' do + it 'returns false on GitLab.com' do + expect(Rails.env).to receive(:development?).and_return(false) + expect(Rails.env).to receive(:test?).and_return(false) allow(Gitlab).to receive(:com?).and_return(true) - expect(described_class.enable?).to eq(true) + expect(described_class.enable?).to eq(false) end - it 'returns true in a non GitLab.com' do - expect(Gitlab).to receive(:com?).and_return(false) + it 'returns false in a non GitLab.com' do + allow(Gitlab).to receive(:com?).and_return(false) expect(Rails.env).to receive(:development?).and_return(false) expect(Rails.env).to receive(:test?).and_return(false) -- cgit v1.2.1