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
bc770be5
Commit
bc770be5
authored
Mar 15, 2013
by
Christian Höltje
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Verify GL_ID environment variable is set.
This also randomizes the key_id used in the tests.
parent
e794bdf3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
spec/gitlab_shell_spec.rb
spec/gitlab_shell_spec.rb
+9
-4
No files found.
spec/gitlab_shell_spec.rb
View file @
bc770be5
...
...
@@ -3,7 +3,7 @@ require_relative '../lib/gitlab_shell'
describe
GitlabShell
do
subject
do
ARGV
[
0
]
=
'key-56'
ARGV
[
0
]
=
key_id
GitlabShell
.
new
.
tap
do
|
shell
|
shell
.
stub
(
exec_cmd: :exec_called
)
shell
.
stub
(
api:
api
)
...
...
@@ -15,11 +15,12 @@ describe GitlabShell do
api
.
stub
(
allowed?:
true
)
end
end
let
(
:key_id
)
{
"key-
#{
rand
(
100
)
+
100
}
"
}
describe
:initialize
do
before
{
ssh_cmd
'git-receive-pack'
}
its
(
:key_id
)
{
should
==
'key-56'
}
its
(
:key_id
)
{
should
==
key_id
}
its
(
:repos_path
)
{
should
==
"/home/git/repositories"
}
end
...
...
@@ -57,6 +58,10 @@ describe GitlabShell do
it
"should execute the command"
do
subject
.
should_receive
(
:exec_cmd
).
with
(
"git-upload-pack /home/git/repositories/gitlab-ci.git"
)
end
it
"should set the GL_ID environment variable"
do
ENV
.
should_receive
(
"[]="
).
with
(
"GL_ID"
,
key_id
)
end
end
context
'git-receive-pack'
do
...
...
@@ -90,7 +95,7 @@ describe GitlabShell do
after
{
subject
.
exec
}
it
"should call api.discover"
do
api
.
should_receive
(
:discover
).
with
(
'key-56'
)
api
.
should_receive
(
:discover
).
with
(
key_id
)
end
end
end
...
...
@@ -101,7 +106,7 @@ describe GitlabShell do
it
"should call api.allowed?"
do
api
.
should_receive
(
:allowed?
).
with
(
'git-upload-pack'
,
'gitlab-ci.git'
,
'key-56'
,
'_any'
)
with
(
'git-upload-pack'
,
'gitlab-ci.git'
,
key_id
,
'_any'
)
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