diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /spec/helpers/issuables_description_templates_helper_spec.rb | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/helpers/issuables_description_templates_helper_spec.rb')
-rw-r--r-- | spec/helpers/issuables_description_templates_helper_spec.rb | 93 |
1 files changed, 27 insertions, 66 deletions
diff --git a/spec/helpers/issuables_description_templates_helper_spec.rb b/spec/helpers/issuables_description_templates_helper_spec.rb index e8961ccb535..95460174266 100644 --- a/spec/helpers/issuables_description_templates_helper_spec.rb +++ b/spec/helpers/issuables_description_templates_helper_spec.rb @@ -13,24 +13,8 @@ RSpec.describe IssuablesDescriptionTemplatesHelper, :clean_gitlab_redis_cache do let_it_be(:group_member) { create(:group_member, :developer, group: parent_group, user: user) } let_it_be(:project_member) { create(:project_member, :developer, user: user, project: project) } - context 'when feature flag disabled' do - before do - stub_feature_flags(inherited_issuable_templates: false) - end - - it 'returns empty array when template type does not exist' do - expect(helper.issuable_templates(project, 'non-existent-template-type')).to eq([]) - end - end - - context 'when feature flag enabled' do - before do - stub_feature_flags(inherited_issuable_templates: true) - end - - it 'returns empty hash when template type does not exist' do - expect(helper.issuable_templates(build(:project), 'non-existent-template-type')).to eq({}) - end + it 'returns empty hash when template type does not exist' do + expect(helper.issuable_templates(build(:project), 'non-existent-template-type')).to eq({}) end context 'with cached issuable templates' do @@ -81,16 +65,18 @@ RSpec.describe IssuablesDescriptionTemplatesHelper, :clean_gitlab_redis_cache do allow(helper).to receive(:issuable_templates).and_return(templates) end - context 'when feature flag disabled' do + context 'with matching project templates' do let(:templates) do - [ - { name: "another_issue_template", id: "another_issue_template", project_id: project.id }, - { name: "custom_issue_template", id: "custom_issue_template", project_id: project.id } - ] - end - - before do - stub_feature_flags(inherited_issuable_templates: false) + { + "" => [ + { name: "another_issue_template", id: "another_issue_template", project_id: project.id }, + { name: "custom_issue_template", id: "custom_issue_template", project_id: project.id } + ], + "Instance" => [ + { name: "first_issue_issue_template", id: "first_issue_issue_template", project_id: non_existing_record_id }, + { name: "second_instance_issue_template", id: "second_instance_issue_template", project_id: non_existing_record_id } + ] + } end it 'returns project templates only' do @@ -98,47 +84,22 @@ RSpec.describe IssuablesDescriptionTemplatesHelper, :clean_gitlab_redis_cache do end end - context 'when feature flag enabled' do - before do - stub_feature_flags(inherited_issuable_templates: true) - end - - context 'with matching project templates' do - let(:templates) do - { - "" => [ - { name: "another_issue_template", id: "another_issue_template", project_id: project.id }, - { name: "custom_issue_template", id: "custom_issue_template", project_id: project.id } - ], - "Instance" => [ - { name: "first_issue_issue_template", id: "first_issue_issue_template", project_id: non_existing_record_id }, - { name: "second_instance_issue_template", id: "second_instance_issue_template", project_id: non_existing_record_id } - ] - } - end - - it 'returns project templates only' do - expect(helper.issuable_templates_names(Issue.new)).to eq(%w[another_issue_template custom_issue_template]) - end + context 'without matching project templates' do + let(:templates) do + { + "Project Templates" => [ + { name: "another_issue_template", id: "another_issue_template", project_id: non_existing_record_id }, + { name: "custom_issue_template", id: "custom_issue_template", project_id: non_existing_record_id } + ], + "Instance" => [ + { name: "first_issue_issue_template", id: "first_issue_issue_template", project_id: non_existing_record_id }, + { name: "second_instance_issue_template", id: "second_instance_issue_template", project_id: non_existing_record_id } + ] + } end - context 'without matching project templates' do - let(:templates) do - { - "Project Templates" => [ - { name: "another_issue_template", id: "another_issue_template", project_id: non_existing_record_id }, - { name: "custom_issue_template", id: "custom_issue_template", project_id: non_existing_record_id } - ], - "Instance" => [ - { name: "first_issue_issue_template", id: "first_issue_issue_template", project_id: non_existing_record_id }, - { name: "second_instance_issue_template", id: "second_instance_issue_template", project_id: non_existing_record_id } - ] - } - end - - it 'returns empty array' do - expect(helper.issuable_templates_names(Issue.new)).to eq([]) - end + it 'returns empty array' do + expect(helper.issuable_templates_names(Issue.new)).to eq([]) end end |