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:
authorYorick Peterse <yorickpeterse@gmail.com>2016-03-18 14:47:36 +0300
committerYorick Peterse <yorickpeterse@gmail.com>2016-03-19 23:54:08 +0300
commit41b8d22631053e66043d05695d65f4961b91efd8 (patch)
treef598203c809c87e4997e475055b6c592a9aecb42 /spec/models/issue_spec.rb
parent3f22a92f4a561543c2249786b695d0c65120455b (diff)
Tweaked performance of Issue#related_branches
Requesting the branch names of a repository works even when it's empty, thus there's no need to explicitly check for an empty repository. Removing this check cuts down the amount of Git operations which in turn cuts down request timings a bit. The regular expression used to compare branches was also moved out of the loop so it's created only once.
Diffstat (limited to 'spec/models/issue_spec.rb')
-rw-r--r--spec/models/issue_spec.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb
index 540a62eb1f8..77d046fb0eb 100644
--- a/spec/models/issue_spec.rb
+++ b/spec/models/issue_spec.rb
@@ -133,9 +133,9 @@ describe Issue, models: true do
describe '#related_branches' do
it "selects the right branches" do
allow(subject.project.repository).to receive(:branch_names).
- and_return(["mpempe", "#{subject.iid}mepmep", subject.to_branch_name])
+ and_return(["mpempe", "#{subject.iid}mepmep", subject.to_branch_name])
- expect(subject.related_branches).to eq [subject.to_branch_name]
+ expect(subject.related_branches).to eq([subject.to_branch_name])
end
end