diff options
Diffstat (limited to 'spec/helpers/issues_helper_spec.rb')
-rw-r--r-- | spec/helpers/issues_helper_spec.rb | 72 |
1 files changed, 71 insertions, 1 deletions
diff --git a/spec/helpers/issues_helper_spec.rb b/spec/helpers/issues_helper_spec.rb index 21a01f349b5..17e6c75ca27 100644 --- a/spec/helpers/issues_helper_spec.rb +++ b/spec/helpers/issues_helper_spec.rb @@ -293,23 +293,32 @@ RSpec.describe IssuesHelper do allow(helper).to receive(:url_for).and_return('#') expected = { + autocomplete_award_emojis_path: autocomplete_award_emojis_path, + autocomplete_users_path: autocomplete_users_path(active: true, current_user: true, project_id: project.id, format: :json), calendar_path: '#', can_bulk_update: 'true', can_edit: 'true', can_import_issues: 'true', email: current_user&.notification_email, + emails_help_page_path: help_page_path('development/emails', anchor: 'email-namespace'), empty_state_svg_path: '#', endpoint: expose_path(api_v4_projects_issues_path(id: project.id)), export_csv_path: export_csv_project_issues_path(project), - full_path: project.full_path, has_issues: project_issues(project).exists?.to_s, import_csv_issues_path: '#', + initial_email: project.new_issuable_address(current_user, 'issue'), is_signed_in: current_user.present?.to_s, issues_path: project_issues_path(project), jira_integration_path: help_page_url('user/project/integrations/jira', anchor: 'view-jira-issues'), + markdown_help_path: help_page_path('user/markdown'), max_attachment_size: number_to_human_size(Gitlab::CurrentSettings.max_attachment_size.megabytes), new_issue_path: new_project_issue_path(project, issue: { assignee_id: finder.assignee.id, milestone_id: finder.milestones.first.id }), project_import_jira_path: project_import_jira_path(project), + project_labels_path: project_labels_path(project, include_ancestor_groups: true, format: :json), + project_milestones_path: project_milestones_path(project, format: :json), + project_path: project.full_path, + quick_actions_help_path: help_page_path('user/project/quick_actions'), + reset_path: new_issuable_address_project_path(project, issuable_type: 'issue'), rss_path: '#', show_new_issue_link: 'true', sign_in_path: new_user_session_path @@ -332,4 +341,65 @@ RSpec.describe IssuesHelper do end end end + + describe '#issue_manual_ordering_class' do + context 'when sorting by relative position' do + before do + assign(:sort, 'relative_position') + end + + it 'returns manual ordering class' do + expect(helper.issue_manual_ordering_class).to eq("manual-ordering") + end + + context 'when manual sorting disabled' do + before do + allow(helper).to receive(:issue_repositioning_disabled?).and_return(true) + end + + it 'returns nil' do + expect(helper.issue_manual_ordering_class).to eq(nil) + end + end + end + end + + describe '#issue_repositioning_disabled?' do + let_it_be(:group) { create(:group) } + let_it_be(:project) { create(:project, group: group) } + + subject { helper.issue_repositioning_disabled? } + + context 'for project' do + before do + assign(:project, project) + end + + it { is_expected.to eq(false) } + + context 'when block_issue_repositioning feature flag is enabled' do + before do + stub_feature_flags(block_issue_repositioning: group) + end + + it { is_expected.to eq(true) } + end + end + + context 'for group' do + before do + assign(:group, group) + end + + it { is_expected.to eq(false) } + + context 'when block_issue_repositioning feature flag is enabled' do + before do + stub_feature_flags(block_issue_repositioning: group) + end + + it { is_expected.to eq(true) } + end + end + end end |