diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-03-11 14:19:38 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-03-11 14:19:38 +0200 |
commit | a94d899692f3869c55bd9db5588b337b8fabdaf2 (patch) | |
tree | 03d215660dd90e247f4cb800712a52610e57dc78 /spec/gitlab_net_spec.rb | |
parent | 238fd9b65f243fef552a1e7aa0bf2e3ba6e52b10 (diff) | |
download | gitlab-shell-a94d899692f3869c55bd9db5588b337b8fabdaf2.tar.gz |
test GitlabNet allowed method
Diffstat (limited to 'spec/gitlab_net_spec.rb')
-rw-r--r-- | spec/gitlab_net_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/gitlab_net_spec.rb b/spec/gitlab_net_spec.rb new file mode 100644 index 0000000..5bda95e --- /dev/null +++ b/spec/gitlab_net_spec.rb @@ -0,0 +1,27 @@ +require_relative 'spec_helper' +require_relative '../lib/gitlab_net' + + +describe GitlabNet do + describe :allowed? do + let(:gitlab_net) { GitlabNet.new } + + before do + gitlab_net.stub!(:host).and_return('https://dev.gitlab.org/api/v3/internal') + end + + it 'should allow pull access for dev.gitlab.org', vcr: true do + VCR.use_cassette("allowed-pull") do + access = gitlab_net.allowed?('git-receive-pack', 'gitlab/gitlabhq.git', 'key-1', 'master') + access.should be_true + end + end + + it 'should allow push access for dev.gitlab.org', vcr: true do + VCR.use_cassette("allowed-push") do + access = gitlab_net.allowed?('git-upload-pack', 'gitlab/gitlabhq.git', 'key-1', 'master') + access.should be_true + end + end + end +end |