summaryrefslogtreecommitdiff
path: root/spec/gitlab_net_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/gitlab_net_spec.rb')
-rw-r--r--spec/gitlab_net_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/gitlab_net_spec.rb b/spec/gitlab_net_spec.rb
index 6b0b65a..b62e2c6 100644
--- a/spec/gitlab_net_spec.rb
+++ b/spec/gitlab_net_spec.rb
@@ -8,6 +8,7 @@ describe GitlabNet, vcr: true do
before do
gitlab_net.stub!(:host).and_return('https://dev.gitlab.org/api/v3/internal')
+ gitlab_net.stub!(:secret_token).and_return('a123')
end
describe :check do
@@ -17,6 +18,13 @@ describe GitlabNet, vcr: true do
result.code.should == '200'
end
end
+
+ it 'adds the secret_token to request' do
+ VCR.use_cassette("check-ok") do
+ Net::HTTP::Get.any_instance.should_receive(:set_form_data).with(hash_including(secret_token: 'a123'))
+ gitlab_net.check
+ end
+ end
end
describe :discover do
@@ -26,6 +34,13 @@ describe GitlabNet, vcr: true do
user['name'].should == 'Dmitriy Zaporozhets'
end
end
+
+ it 'adds the secret_token to request' do
+ VCR.use_cassette("discover-ok") do
+ Net::HTTP::Get.any_instance.should_receive(:set_form_data).with(hash_including(secret_token: 'a123'))
+ gitlab_net.discover('key-126')
+ end
+ end
end
describe :allowed? do
@@ -37,6 +52,13 @@ describe GitlabNet, vcr: true do
end
end
+ it 'adds the secret_token theo request' do
+ VCR.use_cassette("allowed-pull") do
+ Net::HTTP::Post.any_instance.should_receive(:set_form_data).with(hash_including(secret_token: 'a123'))
+ gitlab_net.allowed?('git-receive-pack', 'gitlab/gitlabhq.git', 'key-126', changes)
+ end
+ end
+
it 'should allow push access for dev.gitlab.org' do
VCR.use_cassette("allowed-push") do
access = gitlab_net.allowed?('git-upload-pack', 'gitlab/gitlabhq.git', 'key-126', changes)