diff options
author | Sean McGivern <sean@gitlab.com> | 2017-10-11 18:48:43 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2017-10-12 15:26:03 +0300 |
commit | b7303b65b1a761c7ad7ed9eed993ad55fcecb953 (patch) | |
tree | e1d7048be0f5994d9750b5c8b86c384291a0c459 /spec/lib/gitlab/file_detector_spec.rb | |
parent | 218e1f0963768fced0ed9a33762253c273c72069 (diff) |
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.rb | 8 |
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 |