diff options
author | Gabriel Mazetto <brodock@gmail.com> | 2017-09-25 00:30:53 +0200 |
---|---|---|
committer | Gabriel Mazetto <brodock@gmail.com> | 2017-09-25 00:34:12 +0200 |
commit | c505a5234745f4a879ad336a0de92586c9bc9162 (patch) | |
tree | 92ac3dfdcc81bce639bfc297adab13048bcf613f /spec | |
parent | e2b195b2748c88e276163d44cdeff5b210f2522c (diff) | |
download | gitlab-ce-c505a5234745f4a879ad336a0de92586c9bc9162.tar.gz |
Fixed few gitlab:check tasks that were failing with exception38280-undefined-run_command-when-running-rake-gitlab-check
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/system_check/base_check_spec.rb | 17 | ||||
-rw-r--r-- | spec/tasks/gitlab/task_helpers_spec.rb | 20 |
2 files changed, 37 insertions, 0 deletions
diff --git a/spec/lib/system_check/base_check_spec.rb b/spec/lib/system_check/base_check_spec.rb new file mode 100644 index 00000000000..faf8c99e772 --- /dev/null +++ b/spec/lib/system_check/base_check_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe SystemCheck::BaseCheck do + context 'helpers on instance level' do + it 'responds to SystemCheck::Helpers methods' do + expect(subject).to respond_to :fix_and_rerun, :for_more_information, :see_installation_guide_section, + :finished_checking, :start_checking, :try_fixing_it, :sanitized_message, :should_sanitize?, :omnibus_gitlab?, + :sudo_gitlab + end + + it 'responds to Gitlab::TaskHelpers methods' do + expect(subject).to respond_to :ask_to_continue, :os_name, :prompt, :run_and_match, :run_command, + :run_command!, :uid_for, :gid_for, :gitlab_user, :gitlab_user?, :warn_user_is_not_gitlab, :all_repos, + :repository_storage_paths_args, :user_home, :checkout_or_clone_version, :clone_repo, :checkout_version + end + end +end diff --git a/spec/tasks/gitlab/task_helpers_spec.rb b/spec/tasks/gitlab/task_helpers_spec.rb index d34617be474..fae5ec35c47 100644 --- a/spec/tasks/gitlab/task_helpers_spec.rb +++ b/spec/tasks/gitlab/task_helpers_spec.rb @@ -75,4 +75,24 @@ describe Gitlab::TaskHelpers do subject.checkout_version(tag, clone_path) end end + + describe '#run_command' do + it 'runs command and return the output' do + expect(subject.run_command(%w(echo it works!))).to eq("it works!\n") + end + + it 'returns empty string when command doesnt exist' do + expect(subject.run_command(%w(nonexistentcommand with arguments))).to eq('') + end + end + + describe '#run_command!' do + it 'runs command and return the output' do + expect(subject.run_command!(%w(echo it works!))).to eq("it works!\n") + end + + it 'returns and exception when command exit with non zero code' do + expect { subject.run_command!(['bash', '-c', 'exit 1']) }.to raise_error Gitlab::TaskFailedError + end + end end |