diff options
-rw-r--r-- | lib/gitlab_projects.rb | 2 | ||||
-rw-r--r-- | spec/gitlab_net_spec.rb | 9 | ||||
-rw-r--r-- | spec/gitlab_projects_spec.rb | 8 | ||||
-rw-r--r-- | spec/vcr_cassettes/check-ok.yml | 48 |
4 files changed, 67 insertions, 0 deletions
diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb index 220ecb1..1b23438 100644 --- a/lib/gitlab_projects.rb +++ b/lib/gitlab_projects.rb @@ -1,6 +1,8 @@ require 'open3' require 'fileutils' +require_relative 'gitlab_config' + class GitlabProjects # 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 diff --git a/spec/gitlab_net_spec.rb b/spec/gitlab_net_spec.rb index 7d2d7d9..965fa8e 100644 --- a/spec/gitlab_net_spec.rb +++ b/spec/gitlab_net_spec.rb @@ -9,6 +9,15 @@ describe GitlabNet, vcr: true do gitlab_net.stub!(:host).and_return('https://dev.gitlab.org/api/v3/internal') 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 it 'should return user has based on key id' do VCR.use_cassette("discover-ok") do diff --git a/spec/gitlab_projects_spec.rb b/spec/gitlab_projects_spec.rb index 87c64b7..a9eb15f 100644 --- a/spec/gitlab_projects_spec.rb +++ b/spec/gitlab_projects_spec.rb @@ -62,6 +62,14 @@ describe GitlabProjects do 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) argv(*args) gl_projects = GitlabProjects.new diff --git a/spec/vcr_cassettes/check-ok.yml b/spec/vcr_cassettes/check-ok.yml new file mode 100644 index 0000000..bac5d43 --- /dev/null +++ b/spec/vcr_cassettes/check-ok.yml @@ -0,0 +1,48 @@ +--- +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 |