summaryrefslogtreecommitdiff
path: root/spec/gitlab_lfs_authentication_spec.rb
diff options
context:
space:
mode:
authorPatricio Cano <suprnova32@gmail.com>2016-08-29 14:41:39 -0500
committerPatricio Cano <suprnova32@gmail.com>2016-09-06 12:06:45 -0500
commita64f174d83caddfd3fe31698b5b2fd7701b5a573 (patch)
tree8172013137ce1e28e527825a15e4066944a952bb /spec/gitlab_lfs_authentication_spec.rb
parentdbf374e10ad859a02ef69af53031e245913b6e65 (diff)
downloadgitlab-shell-a64f174d83caddfd3fe31698b5b2fd7701b5a573.tar.gz
Refactored JSON header generation to its own class and added tests for it
Diffstat (limited to 'spec/gitlab_lfs_authentication_spec.rb')
-rw-r--r--spec/gitlab_lfs_authentication_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/gitlab_lfs_authentication_spec.rb b/spec/gitlab_lfs_authentication_spec.rb
new file mode 100644
index 0000000..f4fee77
--- /dev/null
+++ b/spec/gitlab_lfs_authentication_spec.rb
@@ -0,0 +1,21 @@
+require 'spec_helper'
+require 'gitlab_lfs_authentication'
+
+describe GitlabLfsAuthentication do
+ let(:user) { { 'username' => 'dzaporozhets', 'lfs_token' => 'wsnys8Zm8Jn7zyhHTAAK' } }
+
+ subject do
+ GitlabLfsAuthentication.new(user, 'http://gitlab.dev/repo')
+ end
+
+ describe '#initialize' do
+ it { subject.user.should == user }
+ it { subject.repository_http_path.should == 'http://gitlab.dev/repo' }
+ end
+
+ describe '#authenticate!' do
+ result = "{\"header\":{\"Authorization\":\"Basic ZHphcG9yb3poZXRzOndzbnlzOFptOEpuN3p5aEhUQUFL\"},\"href\":\"http://gitlab.dev/repo/info/lfs/\"}"
+
+ it { subject.authenticate!.should == result }
+ end
+end