diff options
author | rpereira2 <rpereira@gitlab.com> | 2019-02-06 18:38:00 +0530 |
---|---|---|
committer | rpereira2 <rpereira@gitlab.com> | 2019-02-06 21:09:01 +0530 |
commit | 8c395f2f7d17ed84044c91bd632e83d6b803d5ce (patch) | |
tree | 8c1118b4849084c770899b118edf5dd75d3c7c22 | |
parent | 610659fe9f03791839b2159cdafce2061c1aec88 (diff) | |
download | gitlab-ce-55199-error-tracking-controller.tar.gz |
Implement review suggestions55199-error-tracking-controller
- Use if else end instead of unless guard.
- Use allow in before block instead of expect.
-rw-r--r-- | app/controllers/projects/error_tracking_controller.rb | 10 | ||||
-rw-r--r-- | spec/controllers/projects/error_tracking_controller_spec.rb | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/app/controllers/projects/error_tracking_controller.rb b/app/controllers/projects/error_tracking_controller.rb index 2cd3dad12a2..88d0755f41f 100644 --- a/app/controllers/projects/error_tracking_controller.rb +++ b/app/controllers/projects/error_tracking_controller.rb @@ -48,7 +48,11 @@ class Projects::ErrorTrackingController < Projects::ApplicationController ) result = service.execute - unless result[:status] == :success + if result[:status] == :success + render json: { + projects: serialize_projects(result[:projects]) + } + else return render( status: result[:http_status] || :bad_request, json: { @@ -56,10 +60,6 @@ class Projects::ErrorTrackingController < Projects::ApplicationController } ) end - - render json: { - projects: serialize_projects(result[:projects]) - } end def list_projects_params diff --git a/spec/controllers/projects/error_tracking_controller_spec.rb b/spec/controllers/projects/error_tracking_controller_spec.rb index db23e3d917b..844c61f1ace 100644 --- a/spec/controllers/projects/error_tracking_controller_spec.rb +++ b/spec/controllers/projects/error_tracking_controller_spec.rb @@ -161,7 +161,7 @@ describe Projects::ErrorTrackingController do end before do - expect(ErrorTracking::ListProjectsService) + allow(ErrorTracking::ListProjectsService) .to receive(:new).with(project, user, permitted_params) .and_return(list_projects_service) end |