Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-shell
Commits
15bec205
Commit
15bec205
authored
May 17, 2013
by
ash
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add logging specs for gitlab-keys.
parent
671e86db
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
spec/gitlab_keys_spec.rb
spec/gitlab_keys_spec.rb
+21
-0
No files found.
spec/gitlab_keys_spec.rb
View file @
15bec205
...
...
@@ -2,6 +2,10 @@ require_relative 'spec_helper'
require_relative
'../lib/gitlab_keys'
describe
GitlabKeys
do
before
do
$logger
=
double
(
'logger'
).
as_null_object
end
describe
:initialize
do
let
(
:gitlab_keys
)
{
build_gitlab_keys
(
'add-key'
,
'key-741'
,
'ssh-rsa AAAAB3NzaDAxx2E'
)
}
...
...
@@ -18,6 +22,11 @@ describe GitlabKeys do
gitlab_keys
.
should_receive
(
:system
).
with
(
valid_cmd
)
gitlab_keys
.
send
:add_key
end
it
"should log an add-key event"
do
$logger
.
should_receive
(
:info
).
with
(
'Adding key key-741 => "ssh-rsa AAAAB3NzaDAxx2E"'
)
gitlab_keys
.
send
:add_key
end
end
describe
:rm_key
do
...
...
@@ -28,6 +37,11 @@ describe GitlabKeys do
gitlab_keys
.
should_receive
(
:system
).
with
(
valid_cmd
)
gitlab_keys
.
send
:rm_key
end
it
"should log an rm-key event"
do
$logger
.
should_receive
(
:info
).
with
(
'Removing key key-741'
)
gitlab_keys
.
send
:rm_key
end
end
describe
:exec
do
...
...
@@ -48,6 +62,13 @@ describe GitlabKeys do
gitlab_keys
.
should_receive
(
:puts
).
with
(
'not allowed'
)
gitlab_keys
.
exec
end
it
'should log an error on unknown commands'
do
gitlab_keys
=
build_gitlab_keys
(
'nooope'
)
gitlab_keys
.
stub
(
puts:
nil
)
$logger
.
should_receive
(
:error
).
with
(
'Attempt to execute invalid gitlab-keys command "nooope".'
)
gitlab_keys
.
exec
end
end
def
build_gitlab_keys
(
*
args
)
...
...
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