diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /spec/helpers/issuables_helper_spec.rb | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/helpers/issuables_helper_spec.rb')
-rw-r--r-- | spec/helpers/issuables_helper_spec.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/helpers/issuables_helper_spec.rb b/spec/helpers/issuables_helper_spec.rb index ee5b0145d13..73527bea14e 100644 --- a/spec/helpers/issuables_helper_spec.rb +++ b/spec/helpers/issuables_helper_spec.rb @@ -294,6 +294,7 @@ RSpec.describe IssuablesHelper do projectPath: @project.path, projectId: @project.id, projectNamespace: @project.namespace.path, + state: issue.state, initialTitleHtml: issue.title, initialTitleText: issue.title, initialDescriptionHtml: '<p dir="auto">issue text</p>', @@ -464,6 +465,41 @@ RSpec.describe IssuablesHelper do end end + describe '#state_name_with_icon' do + let_it_be(:project) { create(:project, :repository) } + + context 'for an issue' do + let_it_be(:issue) { create(:issue, project: project) } + let_it_be(:issue_closed) { create(:issue, :closed, project: project) } + + it 'returns the correct state name and icon when issue is open' do + expect(helper.state_name_with_icon(issue)).to match_array([_('Open'), 'issues']) + end + + it 'returns the correct state name and icon when issue is closed' do + expect(helper.state_name_with_icon(issue_closed)).to match_array([_('Closed'), 'issue-closed']) + end + end + + context 'for a merge request' do + let_it_be(:merge_request) { create(:merge_request, source_project: project) } + let_it_be(:merge_request_merged) { create(:merge_request, :merged, source_project: project) } + let_it_be(:merge_request_closed) { create(:merge_request, :closed, source_project: project) } + + it 'returns the correct state name and icon when merge request is open' do + expect(helper.state_name_with_icon(merge_request)).to match_array([_('Open'), 'merge-request-open']) + end + + it 'returns the correct state name and icon when merge request is merged' do + expect(helper.state_name_with_icon(merge_request_merged)).to match_array([_('Merged'), 'merge']) + end + + it 'returns the correct state name and icon when merge request is closed' do + expect(helper.state_name_with_icon(merge_request_closed)).to match_array([_('Closed'), 'merge-request-close']) + end + end + end + describe '#issuable_display_type' do using RSpec::Parameterized::TableSyntax |