Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
d6e5b443
Commit
d6e5b443
authored
Jun 12, 2020
by
Rajendra Kadam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix rubocop offense and use attr_accessor
parent
56b93d1c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
app/services/keys/create_service.rb
app/services/keys/create_service.rb
+2
-0
ee/app/services/ee/keys/create_service.rb
ee/app/services/ee/keys/create_service.rb
+1
-1
ee/spec/services/keys/create_service_spec.rb
ee/spec/services/keys/create_service_spec.rb
+5
-3
No files found.
app/services/keys/create_service.rb
View file @
d6e5b443
...
...
@@ -2,6 +2,8 @@
module
Keys
class
CreateService
<
::
Keys
::
BaseService
attr_accessor
:current_user
def
initialize
(
current_user
,
params
=
{})
@current_user
,
@params
=
current_user
,
params
@ip_address
=
@params
.
delete
(
:ip_address
)
...
...
ee/app/services/ee/keys/create_service.rb
View file @
d6e5b443
...
...
@@ -14,7 +14,7 @@ module EE
end
def
audit_event_service
::
AuditEventService
.
new
(
@
current_user
,
::
AuditEventService
.
new
(
current_user
,
user
,
action: :custom
,
custom_message:
'Added SSH key'
,
...
...
ee/spec/services/keys/create_service_spec.rb
View file @
d6e5b443
...
...
@@ -3,18 +3,20 @@
require
'spec_helper'
RSpec
.
describe
Keys
::
CreateService
do
let
(
:admin
_user
)
{
create
(
:admin
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:params
)
{
attributes_for
(
:key
).
merge
(
user:
user
)
}
subject
{
described_class
.
new
(
admin
_user
,
params
)
}
subject
{
described_class
.
new
(
admin
,
params
)
}
it
'creates'
do
stub_licensed_features
(
extended_audit_events:
true
)
expect
{
subject
.
execute
}.
to
change
{
SecurityEvent
.
count
}.
by
(
1
)
event
=
SecurityEvent
.
last
expect
(
event
.
author_name
).
to
eq
(
admin_user
.
name
)
expect
(
event
.
author_name
).
to
eq
(
admin
.
name
)
expect
(
event
.
entity_id
).
to
eq
(
user
.
id
)
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment