From 62ae61ed96005c42d3de597a0c8b17f233e46f2e Mon Sep 17 00:00:00 2001 From: James Edwards-Jones Date: Tue, 7 Feb 2017 21:14:04 +0000 Subject: CI runs lint on shell scripts in lib/support --- spec/tasks/config_lint_spec.rb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 spec/tasks/config_lint_spec.rb (limited to 'spec/tasks') 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 -- cgit v1.2.1