summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-02-08 03:14:02 +0000
committerDouwe Maan <douwe@gitlab.com>2017-02-08 03:14:02 +0000
commitbbb7fbcd02c9d9a8a6d6ca44d7ce668b80962c21 (patch)
tree7e878e73c37c93703ddbd14d7cd1dcd83836c380 /spec
parent980ffa201e1bc3171faf08705cd5d2078483b63f (diff)
parent62ae61ed96005c42d3de597a0c8b17f233e46f2e (diff)
downloadgitlab-ce-dz-nested-groups-docs.tar.gz
Merge branch 'jej-lint-scripts-and-config' into 'master'dz-nested-groups-docs
Syntax linting for init scripts Closes #27787 See merge request !9054
Diffstat (limited to 'spec')
-rw-r--r--spec/tasks/config_lint_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/tasks/config_lint_spec.rb b/spec/tasks/config_lint_spec.rb
new file mode 100644
index 00000000000..c32f9a740b7
--- /dev/null
+++ b/spec/tasks/config_lint_spec.rb
@@ -0,0 +1,27 @@
+require 'rake_helper'
+Rake.application.rake_require 'tasks/config_lint'
+
+describe ConfigLint do
+ let(:files){ ['lib/support/fake.sh'] }
+
+ it 'errors out if any bash scripts have errors' do
+ expect { ConfigLint.run(files){ system('exit 1') } }.to raise_error(SystemExit)
+ end
+
+ it 'passes if all scripts are fine' do
+ expect { ConfigLint.run(files){ system('exit 0') } }.not_to raise_error
+ end
+end
+
+describe 'config_lint rake task' do
+ before(:each) do
+ # Prevent `system` from actually being called
+ allow(Kernel).to receive(:system).and_return(true)
+ end
+
+ it 'runs lint on shell scripts' do
+ expect(Kernel).to receive(:system).with('bash', '-n', 'lib/support/init.d/gitlab')
+
+ run_rake_task('config_lint')
+ end
+end