diff options
Diffstat (limited to 'spec/controllers/projects/issues_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/issues_controller_spec.rb | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index ed5198bf015..f956baa0e22 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -388,15 +388,23 @@ RSpec.describe Projects::IssuesController do # Rails router. A controller-style spec matches the wrong route, and # session['user_return_to'] becomes incorrect. describe 'Redirect after sign in', type: :request do - context 'with an AJAX request' do + before_all do + project.add_developer(user) + end + + before do + login_as(user) + end + + context 'with a JSON request' do it 'does not store the visited URL' do - get project_issue_path(project, issue), xhr: true + get project_issue_path(project, issue, format: :json) expect(session['user_return_to']).to be_blank end end - context 'without an AJAX request' do + context 'with an HTML request' do it 'stores the visited URL' do get project_issue_path(project, issue) @@ -1642,7 +1650,7 @@ RSpec.describe Projects::IssuesController do end it 'allows CSV export' do - expect(ExportCsvWorker).to receive(:perform_async).with(viewer.id, project.id, anything) + expect(IssuableExportCsvWorker).to receive(:perform_async).with(:issue, viewer.id, project.id, anything) request_csv @@ -1657,7 +1665,7 @@ RSpec.describe Projects::IssuesController do it 'redirects to the sign in page' do request_csv - expect(ExportCsvWorker).not_to receive(:perform_async) + expect(IssuableExportCsvWorker).not_to receive(:perform_async) expect(response).to redirect_to(new_user_session_path) end end |