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
17f5fe3f
Commit
17f5fe3f
authored
Jul 04, 2017
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CE->EE] Fix few specs in spec/lib/gitlab/shell_spec.rb
parent
721b6455
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
26 deletions
+13
-26
spec/lib/gitlab/shell_spec.rb
spec/lib/gitlab/shell_spec.rb
+13
-26
No files found.
spec/lib/gitlab/shell_spec.rb
View file @
17f5fe3f
...
...
@@ -57,8 +57,9 @@ describe Gitlab::Shell, lib: true do
describe
'#mv_repository'
do
it
'executes the command'
do
expect
(
Gitlab
::
Utils
).
to
receive
(
:system_silent
)
.
with
([
projects_path
,
'mv-project'
,
'storage/path'
,
'project/path.git'
,
'new/path.git'
])
expect
(
gitlab_shell
).
to
receive
(
:gitlab_shell_fast_execute
).
with
(
[
projects_path
,
'mv-project'
,
'storage/path'
,
'project/path.git'
,
'new/path.git'
]
)
gitlab_shell
.
mv_repository
(
'storage/path'
,
'project/path'
,
'new/path'
)
end
end
...
...
@@ -71,22 +72,6 @@ describe Gitlab::Shell, lib: true do
end
end
describe
'#fetch_remote'
do
it
'executes the command'
do
expect
(
Gitlab
::
Popen
).
to
receive
(
:popen
)
.
with
([
projects_path
,
'fetch-remote'
,
'current/storage'
,
'project/path.git'
,
'new/storage'
,
'800'
]).
and_return
([
nil
,
0
])
expect
(
gitlab_shell
.
fetch_remote
(
'current/storage'
,
'project/path'
,
'new/storage'
)).
to
be
true
end
it
'fails to execute the command'
do
expect
(
Gitlab
::
Popen
).
to
receive
(
:popen
)
.
with
([
projects_path
,
'fetch-remote'
,
'current/storage'
,
'project/path.git'
,
'new/storage'
,
'800'
]).
and_return
([
"error"
,
1
])
expect
{
gitlab_shell
.
fetch_remote
(
'current/storage'
,
'project/path'
,
'new/storage'
)
}.
to
raise_error
(
Gitlab
::
Shell
::
Error
,
"error"
)
end
end
describe
'#push_remote_branches'
do
it
'executes the command'
do
expect
(
Gitlab
::
Popen
).
to
receive
(
:popen
)
...
...
@@ -135,7 +120,7 @@ describe Gitlab::Shell, lib: true do
it
'removes trailing garbage'
do
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'
]
)
...
...
@@ -188,7 +173,7 @@ describe Gitlab::Shell, lib: true do
context
'when authorized_keys_enabled is true'
do
it
'removes trailing garbage'
do
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'
]
)
...
...
@@ -202,7 +187,7 @@ describe Gitlab::Shell, lib: true do
end
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'
)
end
...
...
@@ -215,7 +200,7 @@ describe Gitlab::Shell, lib: true do
it
'removes trailing garbage'
do
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'
]
)
...
...
@@ -226,7 +211,7 @@ describe Gitlab::Shell, lib: true do
context
'when key content is not given'
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
)
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'
]
)
...
...
@@ -239,7 +224,7 @@ describe Gitlab::Shell, lib: true do
context
'when authorized_keys_enabled is true'
do
it
'removes trailing garbage'
do
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
end
...
...
@@ -251,7 +236,7 @@ describe Gitlab::Shell, lib: true do
end
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
end
...
...
@@ -264,7 +249,9 @@ describe Gitlab::Shell, lib: true do
it
'removes trailing garbage'
do
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
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