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:
authorTimothy Andrew <mail@timothyandrew.net>2016-07-06 12:37:30 +0300
committerTimothy Andrew <mail@timothyandrew.net>2016-07-07 07:37:31 +0300
commitb1c81f849e5e5b03f56e89cdcefba029ed5c0543 (patch)
treeccfad1ee0b534e6a2239f8a51fe4d468d4a14896 /spec/models
parentd8d5424d25c1738b170d58657ef71d4dbc89ca5e (diff)
Have `Project#open_branches` return branches that are matched by a wildcard protected branch.
1. The `open_branches` method is used to provide a list of branches while creating a protected branch. 2. It makes sense to include branches which are matched by one or more wildcard protected branches, since the user might want to make exact protected branches from these as well. 3. This also provides a large performance improvement. On my machine, in a project with 5000 branches and 2000 protected branches, the `ProtectedBranches#index` page went from a 40 seconds load time to 4 seconds (10x speedup).
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/project_spec.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 117ffd551e4..cd126027c95 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -438,12 +438,12 @@ describe Project, models: true do
it { expect(project.open_branches.map(&:name)).to include('feature') }
it { expect(project.open_branches.map(&:name)).not_to include('master') }
- it "does not include branches matching a protected branch wildcard" do
+ it "includes branches matching a protected branch wildcard" do
expect(project.open_branches.map(&:name)).to include('feature')
create(:protected_branch, name: 'feat*', project: project)
- expect(Project.find(project.id).open_branches.map(&:name)).not_to include('feature')
+ expect(Project.find(project.id).open_branches.map(&:name)).to include('feature')
end
end