Commit eb2c08d8 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

tests added: GitlabNet check, GitlabProject exec

parent 519ba6f9
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
......
...@@ -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
......
...@@ -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
......
---
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment