summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-05 10:34:08 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-05 10:34:08 +0200
commitc902d83b45ac981d186540dfea80a887882501cf (patch)
tree2a35992e60381322525e0a78896879fd6b84a477
parent58347e5321e42a1ea66663f96454dbb8632a0017 (diff)
downloadgitlab-shell-c902d83b45ac981d186540dfea80a887882501cf.tar.gz
gitlab-project specs
-rw-r--r--spec/gitlab_projects_spec.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/gitlab_projects_spec.rb b/spec/gitlab_projects_spec.rb
new file mode 100644
index 0000000..95e4b92
--- /dev/null
+++ b/spec/gitlab_projects_spec.rb
@@ -0,0 +1,34 @@
+require_relative 'spec_helper'
+require_relative '../lib/gitlab_projects'
+
+describe GitlabProjects do
+ describe :initialize do
+ before do
+ argv('add-project', 'gitlab-ci.git')
+ @gl_projects = GitlabProjects.new
+ end
+
+ it { @gl_projects.project_name.should == 'gitlab-ci.git' }
+ it { @gl_projects.instance_variable_get(:@command).should == 'add-project' }
+ it { @gl_projects.instance_variable_get(:@full_path).should == '/home/git/repositories/gitlab-ci.git' }
+ end
+
+ describe :add_project do
+ before do
+ argv('add-project', 'gitlab-ci.git')
+ @gl_projects = GitlabProjects.new
+ end
+
+ it "should receive valid cmd" do
+ valid_cmd = "cd /home/git/repositories/gitlab-ci.git && git init --bare && ln -s /home/git/gitlab-shell/hooks/post-receive /home/git/repositories/gitlab-ci.git/hooks/post-receive"
+ @gl_projects.should_receive(:system).with(valid_cmd)
+ @gl_projects.send :add_project
+ end
+ end
+
+ def argv(*args)
+ args.each_with_index do |arg, i|
+ ARGV[i] = arg
+ end
+ end
+end