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
eb2c08d8
Commit
eb2c08d8
authored
Mar 11, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests added: GitlabNet check, GitlabProject exec
parent
519ba6f9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
0 deletions
+67
-0
lib/gitlab_projects.rb
lib/gitlab_projects.rb
+2
-0
spec/gitlab_net_spec.rb
spec/gitlab_net_spec.rb
+9
-0
spec/gitlab_projects_spec.rb
spec/gitlab_projects_spec.rb
+8
-0
spec/vcr_cassettes/check-ok.yml
spec/vcr_cassettes/check-ok.yml
+48
-0
No files found.
lib/gitlab_projects.rb
View file @
eb2c08d8
require
'open3'
require
'open3'
require
'fileutils'
require
'fileutils'
require_relative
'gitlab_config'
class
GitlabProjects
class
GitlabProjects
# Project name is a directory name for repository with .git at the end
# Project name is a directory name for repository with .git at the end
# It may be namespaced or not. Like repo.git or gitlab/repo.git
# It may be namespaced or not. Like repo.git or gitlab/repo.git
...
...
spec/gitlab_net_spec.rb
View file @
eb2c08d8
...
@@ -9,6 +9,15 @@ describe GitlabNet, vcr: true do
...
@@ -9,6 +9,15 @@ describe GitlabNet, vcr: true do
gitlab_net
.
stub!
(
:host
).
and_return
(
'https://dev.gitlab.org/api/v3/internal'
)
gitlab_net
.
stub!
(
:host
).
and_return
(
'https://dev.gitlab.org/api/v3/internal'
)
end
end
describe
:check
do
it
'should return 200 code for gitlab check'
do
VCR
.
use_cassette
(
"check-ok"
)
do
result
=
gitlab_net
.
check
result
.
code
.
should
==
'200'
end
end
end
describe
:discover
do
describe
:discover
do
it
'should return user has based on key id'
do
it
'should return user has based on key id'
do
VCR
.
use_cassette
(
"discover-ok"
)
do
VCR
.
use_cassette
(
"discover-ok"
)
do
...
...
spec/gitlab_projects_spec.rb
View file @
eb2c08d8
...
@@ -62,6 +62,14 @@ describe GitlabProjects do
...
@@ -62,6 +62,14 @@ describe GitlabProjects do
end
end
end
end
describe
:exec
do
it
'should puts message if unknown command arg'
do
gitlab_projects
=
build_gitlab_projects
(
'edit-project'
,
repo_name
)
gitlab_projects
.
should_receive
(
:puts
).
with
(
'not allowed'
)
gitlab_projects
.
exec
end
end
def
build_gitlab_projects
(
*
args
)
def
build_gitlab_projects
(
*
args
)
argv
(
*
args
)
argv
(
*
args
)
gl_projects
=
GitlabProjects
.
new
gl_projects
=
GitlabProjects
.
new
...
...
spec/vcr_cassettes/check-ok.yml
0 → 100644
View file @
eb2c08d8
---
http_interactions
:
-
request
:
method
:
get
uri
:
https://dev.gitlab.org/api/v3/internal/check
body
:
encoding
:
US-ASCII
string
:
'
'
headers
:
Accept
:
-
!
'
*/*'
User-Agent
:
-
Ruby
response
:
status
:
code
:
200
message
:
OK
headers
:
Server
:
-
nginx/1.1.19
Date
:
-
Mon, 11 Mar 2013 13:05:30 GMT
Content-Type
:
-
application/json
Content-Length
:
-
'
71'
Connection
:
-
keep-alive
Status
:
-
200 OK
X-Ua-Compatible
:
-
IE=Edge,chrome=1
Etag
:
-
!
'
"cb194c2a4bfe01ae695d15ad834b7f5c"'
Cache-Control
:
-
max-age=0, private, must-revalidate
X-Request-Id
:
-
66424e020a58b1fc50efcf846e301b40
X-Runtime
:
-
'
0.003728'
X-Rack-Cache
:
-
miss
body
:
encoding
:
US-ASCII
string
:
!
'
{"api_version":"v3","gitlab_version":"5.0.0pre","gitlab_rev":"473efc8"}'
http_version
:
recorded_at
:
Mon, 11 Mar 2013 13:05:30 GMT
recorded_with
:
VCR 2.4.0
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