summaryrefslogtreecommitdiff
path: root/spec/controllers/projects
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-20 18:38:24 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-20 18:38:24 +0000
commit983a0bba5d2a042c4a3bbb22432ec192c7501d82 (patch)
treeb153cd387c14ba23bd5a07514c7c01fddf6a78a0 /spec/controllers/projects
parenta2bddee2cdb38673df0e004d5b32d9f77797de64 (diff)
downloadgitlab-ce-983a0bba5d2a042c4a3bbb22432ec192c7501d82.tar.gz
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'spec/controllers/projects')
-rw-r--r--spec/controllers/projects/issues_controller_spec.rb39
-rw-r--r--spec/controllers/projects/merge_requests_controller_spec.rb4
2 files changed, 41 insertions, 2 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) }
diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb
index 5104c83283d..aaeaf53d100 100644
--- a/spec/controllers/projects/merge_requests_controller_spec.rb
+++ b/spec/controllers/projects/merge_requests_controller_spec.rb
@@ -1245,7 +1245,7 @@ describe Projects::MergeRequestsController do
end
it 'renders MergeRequest as JSON' do
- expect(json_response.keys).to include('id', 'iid')
+ expect(json_response.keys).to include('id', 'iid', 'title', 'has_ci', 'merge_status', 'can_be_merged', 'current_user')
end
end
@@ -1279,7 +1279,7 @@ describe Projects::MergeRequestsController do
it 'renders MergeRequest as JSON' do
subject
- expect(json_response.keys).to include('id', 'iid')
+ expect(json_response.keys).to include('id', 'iid', 'title', 'has_ci', 'merge_status', 'can_be_merged', 'current_user')
end
end