summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/file_detector_spec.rb
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-10-11 16:48:43 +0100
committerSean McGivern <sean@gitlab.com>2017-10-12 13:26:03 +0100
commitb7303b65b1a761c7ad7ed9eed993ad55fcecb953 (patch)
treee1d7048be0f5994d9750b5c8b86c384291a0c459 /spec/lib/gitlab/file_detector_spec.rb
parent218e1f0963768fced0ed9a33762253c273c72069 (diff)
downloadgitlab-ce-b7303b65b1a761c7ad7ed9eed993ad55fcecb953.tar.gz
Cache issuable template names
We were looking these up on each request to an issue page, because the form is pre-filled, as is the template dropdown. That was unnecessary: we could just treat these as 'special' repository files (like the rendered README) and cache them in Redis until they change on a push.
Diffstat (limited to 'spec/lib/gitlab/file_detector_spec.rb')
-rw-r--r--spec/lib/gitlab/file_detector_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/lib/gitlab/file_detector_spec.rb b/spec/lib/gitlab/file_detector_spec.rb
index b5ac07c94fa..8e524f9b05a 100644
--- a/spec/lib/gitlab/file_detector_spec.rb
+++ b/spec/lib/gitlab/file_detector_spec.rb
@@ -56,6 +56,14 @@ describe Gitlab::FileDetector do
end
end
+ it 'returns the type of an issue template' do
+ expect(described_class.type_of('.gitlab/issue_templates/foo.md')).to eq(:issue_template)
+ end
+
+ it 'returns the type of a merge request template' do
+ expect(described_class.type_of('.gitlab/merge_request_templates/foo.md')).to eq(:merge_request_template)
+ end
+
it 'returns nil for an unknown file' do
expect(described_class.type_of('foo.txt')).to be_nil
end