diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-14 06:10:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-14 06:10:47 +0300 |
commit | 04698e448a10aedea2f3ed37ffd0327e9b91426e (patch) | |
tree | 8804a89c577dc005d3135d830e28de572f80f05d /spec/support | |
parent | e7cc427bc63dccac50cc3ccda2976befcea1ecf5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/shared_examples/helpers/issuable_description_templates_shared_examples.rb | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/spec/support/shared_examples/helpers/issuable_description_templates_shared_examples.rb b/spec/support/shared_examples/helpers/issuable_description_templates_shared_examples.rb deleted file mode 100644 index dbd4f1927e3..00000000000 --- a/spec/support/shared_examples/helpers/issuable_description_templates_shared_examples.rb +++ /dev/null @@ -1,49 +0,0 @@ -# frozen_string_literal: true - -RSpec.shared_context 'project issuable templates context' do - let_it_be(:issuable_template_files) do - { - '.gitlab/issue_templates/issue-bar.md' => 'Issue Template Bar', - '.gitlab/issue_templates/issue-foo.md' => 'Issue Template Foo', - '.gitlab/issue_templates/issue-bad.txt' => 'Issue Template Bad', - '.gitlab/issue_templates/issue-baz.xyz' => 'Issue Template Baz', - - '.gitlab/merge_request_templates/merge_request-bar.md' => 'Merge Request Template Bar', - '.gitlab/merge_request_templates/merge_request-foo.md' => 'Merge Request Template Foo', - '.gitlab/merge_request_templates/merge_request-bad.txt' => 'Merge Request Template Bad', - '.gitlab/merge_request_templates/merge_request-baz.xyz' => 'Merge Request Template Baz' - } - end -end - -RSpec.shared_examples 'project issuable templates' do - context 'issuable templates' do - before do - allow(helper).to receive(:current_user).and_return(user) - end - - it 'returns only md files as issue templates' do - expect(helper.issuable_templates(project, 'issue')).to eq(expected_templates('issue')) - end - - it 'returns only md files as merge_request templates' do - expect(helper.issuable_templates(project, 'merge_request')).to eq(expected_templates('merge_request')) - end - end - - def expected_templates(issuable_type) - expectation = {} - - expectation["Project Templates"] = templates(issuable_type, project) - expectation["Group #{inherited_from.namespace.full_name}"] = templates(issuable_type, inherited_from) if inherited_from.present? - - expectation - end - - def templates(issuable_type, inherited_from) - [ - { id: "#{issuable_type}-bar", name: "#{issuable_type}-bar", project_id: inherited_from.id }, - { id: "#{issuable_type}-foo", name: "#{issuable_type}-foo", project_id: inherited_from.id } - ] - end -end |