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
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-shell
Commits
ddb95f0d
Commit
ddb95f0d
authored
Aug 20, 2018
by
Ash McKenzie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GitlabConfig, GitlabShell & GitlabKeys spec fixes
GitlabConfig spec was relying upon real config.yml
parent
b0a52635
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
11 deletions
+16
-11
spec/gitlab_config_spec.rb
spec/gitlab_config_spec.rb
+10
-5
spec/gitlab_keys_spec.rb
spec/gitlab_keys_spec.rb
+1
-1
spec/gitlab_shell_spec.rb
spec/gitlab_shell_spec.rb
+5
-5
No files found.
spec/gitlab_config_spec.rb
View file @
ddb95f0d
...
@@ -3,29 +3,34 @@ require_relative '../lib/gitlab_config'
...
@@ -3,29 +3,34 @@ require_relative '../lib/gitlab_config'
describe
GitlabConfig
do
describe
GitlabConfig
do
let
(
:config
)
{
GitlabConfig
.
new
}
let
(
:config
)
{
GitlabConfig
.
new
}
let
(
:config_data
)
{
{}
}
describe
:gitlab_url
do
before
{
expect
(
YAML
).
to
receive
(
:load_file
).
and_return
(
config_data
)
}
describe
'#gitlab_url'
do
let
(
:url
)
{
'http://test.com'
}
let
(
:url
)
{
'http://test.com'
}
subject
{
config
.
gitlab_url
}
subject
{
config
.
gitlab_url
}
before
{
config
.
send
(
:config
)[
'gitlab_url'
]
=
url
}
before
{
config_data
[
'gitlab_url'
]
=
url
}
it
{
is_expected
.
not_to
be_empty
}
it
{
is_expected
.
not_to
be_empty
}
it
{
is_expected
.
to
eq
(
url
)
}
it
{
is_expected
.
to
eq
(
url
)
}
context
'remove trailing slashes'
do
context
'remove trailing slashes'
do
before
{
config
.
send
(
:config
)
[
'gitlab_url'
]
=
url
+
'//'
}
before
{
config
_data
[
'gitlab_url'
]
=
url
+
'//'
}
it
{
is_expected
.
to
eq
(
url
)
}
it
{
is_expected
.
to
eq
(
url
)
}
end
end
end
end
describe
:audit_usernames
do
describe
'#audit_usernames'
do
subject
{
config
.
audit_usernames
}
subject
{
config
.
audit_usernames
}
it
(
"returns false by default"
)
{
is_expected
.
to
eq
(
false
)
}
it
(
"returns false by default"
)
{
is_expected
.
to
eq
(
false
)
}
end
end
describe
:log_format
do
describe
'#log_format'
do
subject
{
config
.
log_format
}
subject
{
config
.
log_format
}
it
'returns "text" by default'
do
it
'returns "text" by default'
do
...
...
spec/gitlab_keys_spec.rb
View file @
ddb95f0d
...
@@ -307,7 +307,7 @@ describe GitlabKeys do
...
@@ -307,7 +307,7 @@ describe GitlabKeys do
key
.
send
:lock
,
1
do
key
.
send
:lock
,
1
do
sleep
2
sleep
2
end
end
end
.
to
raise_error
end
.
to
raise_error
(
Timeout
::
Error
,
'execution expired'
)
end
end
it
"should actually lock file"
do
it
"should actually lock file"
do
...
...
spec/gitlab_shell_spec.rb
View file @
ddb95f0d
...
@@ -68,13 +68,13 @@ describe GitlabShell do
...
@@ -68,13 +68,13 @@ describe GitlabShell do
allow_any_instance_of
(
GitlabConfig
).
to
receive
(
:audit_usernames
).
and_return
(
false
)
allow_any_instance_of
(
GitlabConfig
).
to
receive
(
:audit_usernames
).
and_return
(
false
)
end
end
describe
:initialize
do
describe
'#initialize'
do
let
(
:ssh_cmd
)
{
'git-receive-pack'
}
let
(
:ssh_cmd
)
{
'git-receive-pack'
}
it
{
expect
(
subject
.
gl_id
).
to
eq
gl_id
}
it
{
expect
(
subject
.
gl_id
).
to
eq
gl_id
}
end
end
describe
:parse_cmd
do
describe
'#parse_cmd'
do
describe
'git'
do
describe
'git'
do
context
'w/o namespace'
do
context
'w/o namespace'
do
let
(
:ssh_args
)
{
%w(git-upload-pack gitlab-ci.git)
}
let
(
:ssh_args
)
{
%w(git-upload-pack gitlab-ci.git)
}
...
@@ -161,7 +161,7 @@ describe GitlabShell do
...
@@ -161,7 +161,7 @@ describe GitlabShell do
end
end
end
end
describe
:exec
do
describe
'#exec'
do
let
(
:gitaly_message
)
do
let
(
:gitaly_message
)
do
JSON
.
dump
(
JSON
.
dump
(
'repository'
=>
{
'relative_path'
=>
repo_name
,
'storage_name'
=>
'default'
},
'repository'
=>
{
'relative_path'
=>
repo_name
,
'storage_name'
=>
'default'
},
...
@@ -410,7 +410,7 @@ describe GitlabShell do
...
@@ -410,7 +410,7 @@ describe GitlabShell do
end
end
end
end
describe
:validate_access
do
describe
'#validate_access'
do
let
(
:ssh_cmd
)
{
"git-upload-pack gitlab-ci.git"
}
let
(
:ssh_cmd
)
{
"git-upload-pack gitlab-ci.git"
}
describe
'check access with api'
do
describe
'check access with api'
do
...
@@ -442,7 +442,7 @@ describe GitlabShell do
...
@@ -442,7 +442,7 @@ describe GitlabShell do
end
end
end
end
describe
:api
do
describe
'#api'
do
let
(
:shell
)
{
GitlabShell
.
new
(
gl_id
)
}
let
(
:shell
)
{
GitlabShell
.
new
(
gl_id
)
}
subject
{
shell
.
send
:api
}
subject
{
shell
.
send
:api
}
...
...
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