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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
d9557e43
Commit
d9557e43
authored
Jul 04, 2017
by
Valery Sizov
Committed by
James Edwards-Jones
Jan 08, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport spec fixes in spec/lib/gitlab/shell_spec.rb
parent
01319e59
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
spec/lib/gitlab/shell_spec.rb
spec/lib/gitlab/shell_spec.rb
+12
-10
No files found.
spec/lib/gitlab/shell_spec.rb
View file @
d9557e43
...
@@ -55,7 +55,7 @@ describe Gitlab::Shell do
...
@@ -55,7 +55,7 @@ describe Gitlab::Shell do
context
'when authorized_keys_enabled is true'
do
context
'when authorized_keys_enabled is true'
do
it
'removes trailing garbage'
do
it
'removes trailing garbage'
do
allow
(
gitlab_shell
).
to
receive
(
:gitlab_shell_keys_path
).
and_return
(
:gitlab_shell_keys_path
)
allow
(
gitlab_shell
).
to
receive
(
:gitlab_shell_keys_path
).
and_return
(
:gitlab_shell_keys_path
)
expect
(
Gitlab
::
Utils
).
to
receive
(
:system_silent
).
with
(
expect
(
gitlab_shell
).
to
receive
(
:gitlab_shell_fast_execute
).
with
(
[
:gitlab_shell_keys_path
,
'add-key'
,
'key-123'
,
'ssh-rsa foobar'
]
[
:gitlab_shell_keys_path
,
'add-key'
,
'key-123'
,
'ssh-rsa foobar'
]
)
)
...
@@ -69,7 +69,7 @@ describe Gitlab::Shell do
...
@@ -69,7 +69,7 @@ describe Gitlab::Shell do
end
end
it
'does nothing'
do
it
'does nothing'
do
expect
(
Gitlab
::
Utils
).
not_to
receive
(
:
system_silent
)
expect
(
Gitlab
::
Utils
).
not_to
receive
(
:
gitlab_shell_fast_execute
)
gitlab_shell
.
add_key
(
'key-123'
,
'ssh-rsa foobar trailing garbage'
)
gitlab_shell
.
add_key
(
'key-123'
,
'ssh-rsa foobar trailing garbage'
)
end
end
...
@@ -82,7 +82,7 @@ describe Gitlab::Shell do
...
@@ -82,7 +82,7 @@ describe Gitlab::Shell do
it
'removes trailing garbage'
do
it
'removes trailing garbage'
do
allow
(
gitlab_shell
).
to
receive
(
:gitlab_shell_keys_path
).
and_return
(
:gitlab_shell_keys_path
)
allow
(
gitlab_shell
).
to
receive
(
:gitlab_shell_keys_path
).
and_return
(
:gitlab_shell_keys_path
)
expect
(
Gitlab
::
Utils
).
to
receive
(
:system_silent
).
with
(
expect
(
gitlab_shell
).
to
receive
(
:gitlab_shell_fast_execute
).
with
(
[
:gitlab_shell_keys_path
,
'add-key'
,
'key-123'
,
'ssh-rsa foobar'
]
[
:gitlab_shell_keys_path
,
'add-key'
,
'key-123'
,
'ssh-rsa foobar'
]
)
)
...
@@ -135,7 +135,7 @@ describe Gitlab::Shell do
...
@@ -135,7 +135,7 @@ describe Gitlab::Shell do
context
'when authorized_keys_enabled is true'
do
context
'when authorized_keys_enabled is true'
do
it
'removes trailing garbage'
do
it
'removes trailing garbage'
do
allow
(
gitlab_shell
).
to
receive
(
:gitlab_shell_keys_path
).
and_return
(
:gitlab_shell_keys_path
)
allow
(
gitlab_shell
).
to
receive
(
:gitlab_shell_keys_path
).
and_return
(
:gitlab_shell_keys_path
)
expect
(
Gitlab
::
Utils
).
to
receive
(
:system_silent
).
with
(
expect
(
gitlab_shell
).
to
receive
(
:gitlab_shell_fast_execute
).
with
(
[
:gitlab_shell_keys_path
,
'rm-key'
,
'key-123'
,
'ssh-rsa foobar'
]
[
:gitlab_shell_keys_path
,
'rm-key'
,
'key-123'
,
'ssh-rsa foobar'
]
)
)
...
@@ -149,7 +149,7 @@ describe Gitlab::Shell do
...
@@ -149,7 +149,7 @@ describe Gitlab::Shell do
end
end
it
'does nothing'
do
it
'does nothing'
do
expect
(
Gitlab
::
Utils
).
not_to
receive
(
:system_silent
)
expect
(
gitlab_shell
).
not_to
receive
(
:gitlab_shell_fast_execute
)
gitlab_shell
.
remove_key
(
'key-123'
,
'ssh-rsa foobar'
)
gitlab_shell
.
remove_key
(
'key-123'
,
'ssh-rsa foobar'
)
end
end
...
@@ -162,7 +162,7 @@ describe Gitlab::Shell do
...
@@ -162,7 +162,7 @@ describe Gitlab::Shell do
it
'removes trailing garbage'
do
it
'removes trailing garbage'
do
allow
(
gitlab_shell
).
to
receive
(
:gitlab_shell_keys_path
).
and_return
(
:gitlab_shell_keys_path
)
allow
(
gitlab_shell
).
to
receive
(
:gitlab_shell_keys_path
).
and_return
(
:gitlab_shell_keys_path
)
expect
(
Gitlab
::
Utils
).
to
receive
(
:system_silent
).
with
(
expect
(
gitlab_shell
).
to
receive
(
:gitlab_shell_fast_execute
).
with
(
[
:gitlab_shell_keys_path
,
'rm-key'
,
'key-123'
,
'ssh-rsa foobar'
]
[
:gitlab_shell_keys_path
,
'rm-key'
,
'key-123'
,
'ssh-rsa foobar'
]
)
)
...
@@ -173,7 +173,7 @@ describe Gitlab::Shell do
...
@@ -173,7 +173,7 @@ describe Gitlab::Shell do
context
'when key content is not given'
do
context
'when key content is not given'
do
it
'calls rm-key with only one argument'
do
it
'calls rm-key with only one argument'
do
allow
(
gitlab_shell
).
to
receive
(
:gitlab_shell_keys_path
).
and_return
(
:gitlab_shell_keys_path
)
allow
(
gitlab_shell
).
to
receive
(
:gitlab_shell_keys_path
).
and_return
(
:gitlab_shell_keys_path
)
expect
(
Gitlab
::
Utils
).
to
receive
(
:system_silent
).
with
(
expect
(
gitlab_shell
).
to
receive
(
:gitlab_shell_fast_execute
).
with
(
[
:gitlab_shell_keys_path
,
'rm-key'
,
'key-123'
]
[
:gitlab_shell_keys_path
,
'rm-key'
,
'key-123'
]
)
)
...
@@ -186,7 +186,7 @@ describe Gitlab::Shell do
...
@@ -186,7 +186,7 @@ describe Gitlab::Shell do
context
'when authorized_keys_enabled is true'
do
context
'when authorized_keys_enabled is true'
do
it
'removes trailing garbage'
do
it
'removes trailing garbage'
do
allow
(
gitlab_shell
).
to
receive
(
:gitlab_shell_keys_path
).
and_return
(
:gitlab_shell_keys_path
)
allow
(
gitlab_shell
).
to
receive
(
:gitlab_shell_keys_path
).
and_return
(
:gitlab_shell_keys_path
)
expect
(
Gitlab
::
Utils
).
to
receive
(
:system_silent
).
with
([
:gitlab_shell_keys_path
,
'clear'
])
expect
(
gitlab_shell
).
to
receive
(
:gitlab_shell_fast_execute
).
with
([
:gitlab_shell_keys_path
,
'clear'
])
gitlab_shell
.
remove_all_keys
gitlab_shell
.
remove_all_keys
end
end
...
@@ -198,7 +198,7 @@ describe Gitlab::Shell do
...
@@ -198,7 +198,7 @@ describe Gitlab::Shell do
end
end
it
'does nothing'
do
it
'does nothing'
do
expect
(
Gitlab
::
Utils
).
not_to
receive
(
:system_silent
)
expect
(
gitlab_shell
).
not_to
receive
(
:gitlab_shell_fast_execute
)
gitlab_shell
.
remove_all_keys
gitlab_shell
.
remove_all_keys
end
end
...
@@ -211,7 +211,9 @@ describe Gitlab::Shell do
...
@@ -211,7 +211,9 @@ describe Gitlab::Shell do
it
'removes trailing garbage'
do
it
'removes trailing garbage'
do
allow
(
gitlab_shell
).
to
receive
(
:gitlab_shell_keys_path
).
and_return
(
:gitlab_shell_keys_path
)
allow
(
gitlab_shell
).
to
receive
(
:gitlab_shell_keys_path
).
and_return
(
:gitlab_shell_keys_path
)
expect
(
Gitlab
::
Utils
).
to
receive
(
:system_silent
).
with
([
:gitlab_shell_keys_path
,
'clear'
])
expect
(
gitlab_shell
).
to
receive
(
:gitlab_shell_fast_execute
).
with
(
[
:gitlab_shell_keys_path
,
'clear'
]
)
gitlab_shell
.
remove_all_keys
gitlab_shell
.
remove_all_keys
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