Commit 6362129a authored by Pedro Pombeiro's avatar Pedro Pombeiro

Apply MR review suggestions

parent 25f9eb27
...@@ -6,8 +6,9 @@ module Ci ...@@ -6,8 +6,9 @@ module Ci
# @param [Ci::RunnerProject] runner_project the runner/project association to destroy # @param [Ci::RunnerProject] runner_project the runner/project association to destroy
# @param [User] user the user performing the operation # @param [User] user the user performing the operation
def initialize(runner_project, user) def initialize(runner_project, user)
@runner = runner_project.runner
@runner_project = runner_project @runner_project = runner_project
@runner = runner_project.runner
@project = runner_project.project
@user = user @user = user
end end
...@@ -19,7 +20,7 @@ module Ci ...@@ -19,7 +20,7 @@ module Ci
private private
attr_reader :runner_project, :user attr_reader :runner, :project, :user
end end
end end
end end
......
...@@ -9,11 +9,9 @@ module EE ...@@ -9,11 +9,9 @@ module EE
override :execute override :execute
def execute def execute
runner = runner_project.runner
project = runner_project.project
result = super result = super
audit_log_event(runner, project) if result audit_log_event if result
result result
end end
...@@ -22,7 +20,7 @@ module EE ...@@ -22,7 +20,7 @@ module EE
AUDIT_MESSAGE = 'Unassigned CI runner from project' AUDIT_MESSAGE = 'Unassigned CI runner from project'
def audit_log_event(runner, project) def audit_log_event
::AuditEvents::RunnerCustomAuditEventService.new(runner, user, project, AUDIT_MESSAGE).track_event ::AuditEvents::RunnerCustomAuditEventService.new(runner, user, project, AUDIT_MESSAGE).track_event
end end
end end
......
...@@ -10,10 +10,6 @@ RSpec.describe ::Ci::Runners::UnassignRunnerService, '#execute' do ...@@ -10,10 +10,6 @@ RSpec.describe ::Ci::Runners::UnassignRunnerService, '#execute' do
let(:runner_project) { runner.runner_projects.last } let(:runner_project) { runner.runner_projects.last }
before do
allow(runner_project).to receive(:project).and_return(project)
end
context 'without user' do context 'without user' do
let(:user) { nil } let(:user) { nil }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment