summaryrefslogtreecommitdiff
path: root/spec/helpers/issues_helper_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/helpers/issues_helper_spec.rb')
-rw-r--r--spec/helpers/issues_helper_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/helpers/issues_helper_spec.rb b/spec/helpers/issues_helper_spec.rb
index 1ed61bd3144..07e55e9b016 100644
--- a/spec/helpers/issues_helper_spec.rb
+++ b/spec/helpers/issues_helper_spec.rb
@@ -254,4 +254,31 @@ RSpec.describe IssuesHelper do
expect(helper.use_startup_call?).to eq(true)
end
end
+
+ describe '#issue_header_actions_data' do
+ let(:current_user) { create(:user) }
+
+ before do
+ allow(helper).to receive(:current_user).and_return(current_user)
+ allow(helper).to receive(:can?).and_return(true)
+ end
+
+ it 'returns expected result' do
+ expected = {
+ can_create_issue: "true",
+ can_reopen_issue: "true",
+ can_report_spam: "false",
+ can_update_issue: "true",
+ iid: issue.iid,
+ is_issue_author: "false",
+ issue_type: "issue",
+ new_issue_path: new_project_issue_path(project),
+ project_path: project.full_path,
+ report_abuse_path: new_abuse_report_path(user_id: issue.author.id, ref_url: issue_url(issue)),
+ submit_as_spam_path: mark_as_spam_project_issue_path(project, issue)
+ }
+
+ expect(helper.issue_header_actions_data(project, issue, current_user)).to include(expected)
+ end
+ end
end