summaryrefslogtreecommitdiff
path: root/spec/hooks_utils_spec.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-12-14 09:37:37 +0000
committerDouwe Maan <douwe@gitlab.com>2018-12-14 09:37:37 +0000
commit4581f9d89be721bf853ceac433c2492dd9438c5a (patch)
tree69198bb4580416a9aa2af1473d80e108a997ce5d /spec/hooks_utils_spec.rb
parentcdd9e12beb06354ff0babfb18907d3f184bac547 (diff)
parente4d62acc8d0c1325e6451ce222e7f4d5bdd55fc7 (diff)
downloadgitlab-shell-4581f9d89be721bf853ceac433c2492dd9438c5a.tar.gz
Merge branch 'handle-push-options' into 'master'
Handle push options See merge request gitlab-org/gitlab-shell!166
Diffstat (limited to 'spec/hooks_utils_spec.rb')
-rw-r--r--spec/hooks_utils_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/hooks_utils_spec.rb b/spec/hooks_utils_spec.rb
new file mode 100644
index 0000000..5246bbc
--- /dev/null
+++ b/spec/hooks_utils_spec.rb
@@ -0,0 +1,22 @@
+require_relative 'spec_helper'
+require_relative '../lib/hooks_utils.rb'
+
+describe :get_push_options do
+ context "when GIT_PUSH_OPTION_COUNT is not set" do
+ HooksUtils.get_push_options.should == []
+ end
+
+ context "when one option is given" do
+ ENV['GIT_PUSH_OPTION_COUNT'] = '1'
+ ENV['GIT_PUSH_OPTION_0'] = 'aaa'
+ HooksUtils.get_push_options.should == ['aaa']
+ end
+
+ context "when multiple options are given" do
+ ENV['GIT_PUSH_OPTION_COUNT'] = '3'
+ ENV['GIT_PUSH_OPTION_0'] = 'aaa'
+ ENV['GIT_PUSH_OPTION_1'] = 'bbb'
+ ENV['GIT_PUSH_OPTION_2'] = 'ccc'
+ HooksUtils.get_push_options.should == ['aaa', 'bbb', 'ccc']
+ end
+end