summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-06-10 19:32:30 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-06-10 19:32:30 +0300
commit488a0340fa608af34c36deeba11d4e7192c260bd (patch)
treeb4496127876dd943ff96ae713696aa71fd0d7eda /spec
parent79c58482962bd7ddd4979a4afcd178f697fe84fa (diff)
downloadgitlab-shell-488a0340fa608af34c36deeba11d4e7192c260bd.tar.gz
Update head feature
Diffstat (limited to 'spec')
-rw-r--r--spec/gitlab_projects_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/gitlab_projects_spec.rb b/spec/gitlab_projects_spec.rb
index 5bcc5c8..ba8187e 100644
--- a/spec/gitlab_projects_spec.rb
+++ b/spec/gitlab_projects_spec.rb
@@ -106,6 +106,27 @@ describe GitlabProjects do
end
end
+ describe :update_head do
+ let(:gl_projects) { build_gitlab_projects('update-head', repo_name, 'stable') }
+
+ before do
+ FileUtils.mkdir_p(tmp_repo_path)
+ system("git init --bare #{tmp_repo_path}")
+ system("touch #{tmp_repo_path}/refs/heads/stable")
+ File.read(File.join(tmp_repo_path, 'HEAD')).strip.should == 'ref: refs/heads/master'
+ end
+
+ it "should update head for repo" do
+ gl_projects.exec.should be_true
+ File.read(File.join(tmp_repo_path, 'HEAD')).strip.should == 'ref: refs/heads/stable'
+ end
+
+ it "should log an update_head event" do
+ $logger.should_receive(:info).with("Update head in project #{repo_name} to <stable>.")
+ gl_projects.exec
+ end
+ end
+
describe :import_project do
let(:gl_projects) { build_gitlab_projects('import-project', repo_name, 'https://github.com/randx/six.git') }