diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 21:38:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 21:38:24 +0300 |
commit | 983a0bba5d2a042c4a3bbb22432ec192c7501d82 (patch) | |
tree | b153cd387c14ba23bd5a07514c7c01fddf6a78a0 /spec/controllers/projects/issues_controller_spec.rb | |
parent | a2bddee2cdb38673df0e004d5b32d9f77797de64 (diff) |
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'spec/controllers/projects/issues_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/issues_controller_spec.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index 9526e14a748..862a4bd3559 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -1427,6 +1427,45 @@ describe Projects::IssuesController do end end + describe 'POST export_csv' do + let(:viewer) { user } + let(:issue) { create(:issue, project: project) } + + before do + project.add_developer(user) + end + + def request_csv + post :export_csv, params: { namespace_id: project.namespace.to_param, project_id: project.to_param } + end + + context 'when logged in' do + before do + sign_in(viewer) + end + + it 'allows CSV export' do + expect(ExportCsvWorker).to receive(:perform_async).with(viewer.id, project.id, anything) + + request_csv + + expect(response).to redirect_to(project_issues_path(project)) + expect(response.flash[:notice]).to match(/\AYour CSV export has started/i) + end + end + + context 'when not logged in' do + let(:project) { create(:project_empty_repo, :public) } + + it 'redirects to the sign in page' do + request_csv + + expect(ExportCsvWorker).not_to receive(:perform_async) + expect(response).to redirect_to(new_user_session_path) + end + end + end + describe 'GET #discussions' do let!(:discussion) { create(:discussion_note_on_issue, noteable: issue, project: issue.project) } |