diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /spec/controllers/projects/logs_controller_spec.rb | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) | |
download | gitlab-ce-6e4e1050d9dba2b7b2523fdd1768823ab85feef4.tar.gz |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/controllers/projects/logs_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/logs_controller_spec.rb | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/spec/controllers/projects/logs_controller_spec.rb b/spec/controllers/projects/logs_controller_spec.rb index 0f34e536064..d5c602df41d 100644 --- a/spec/controllers/projects/logs_controller_spec.rb +++ b/spec/controllers/projects/logs_controller_spec.rb @@ -22,8 +22,8 @@ RSpec.describe Projects::LogsController do describe 'GET #index' do let(:empty_project) { create(:project) } - it 'returns 404 with developer access' do - project.add_developer(user) + it 'returns 404 with reporter access' do + project.add_reporter(user) get :index, params: environment_params @@ -31,7 +31,7 @@ RSpec.describe Projects::LogsController do end it 'renders empty logs page if no environment exists' do - empty_project.add_maintainer(user) + empty_project.add_developer(user) get :index, params: { namespace_id: empty_project.namespace, project_id: empty_project } @@ -40,7 +40,7 @@ RSpec.describe Projects::LogsController do end it 'renders index template' do - project.add_maintainer(user) + project.add_developer(user) get :index, params: environment_params @@ -59,6 +59,7 @@ RSpec.describe Projects::LogsController do container_name: container } end + let(:service_result_json) { Gitlab::Json.parse(service_result.to_json) } let_it_be(:cluster) { create(:cluster, :provided_by_gcp, environment_scope: '*', projects: [project]) } @@ -69,14 +70,27 @@ RSpec.describe Projects::LogsController do end end - it 'returns 404 with developer access' do - project.add_developer(user) + it 'returns 404 with reporter access' do + project.add_reporter(user) get endpoint, params: environment_params(pod_name: pod_name, format: :json) expect(response).to have_gitlab_http_status(:not_found) end + context 'with developer access' do + before do + project.add_developer(user) + end + + it 'returns the service result' do + get endpoint, params: environment_params(pod_name: pod_name, format: :json) + + expect(response).to have_gitlab_http_status(:success) + expect(json_response).to eq(service_result_json) + end + end + context 'with maintainer access' do before do project.add_maintainer(user) |