diff options
author | Gabriel Mazetto <brodock@gmail.com> | 2017-09-04 03:58:54 +0200 |
---|---|---|
committer | Gabriel Mazetto <brodock@gmail.com> | 2017-09-04 03:58:54 +0200 |
commit | 706d49b2590cfd70306f14cffdbadd237620a993 (patch) | |
tree | f337960dfb21e090224de21c84d5ad5bdc469cf8 /spec/lib/system_check | |
parent | 6c21e6f91f2da28c0dea6bf3896055daede0a6e3 (diff) | |
download | gitlab-ce-706d49b2590cfd70306f14cffdbadd237620a993.tar.gz |
Added dynamic skip reason to SystemCheck
Diffstat (limited to 'spec/lib/system_check')
-rw-r--r-- | spec/lib/system_check/simple_executor_spec.rb | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/spec/lib/system_check/simple_executor_spec.rb b/spec/lib/system_check/simple_executor_spec.rb index 4de5da984ba..9da3648400e 100644 --- a/spec/lib/system_check/simple_executor_spec.rb +++ b/spec/lib/system_check/simple_executor_spec.rb @@ -35,6 +35,20 @@ describe SystemCheck::SimpleExecutor do end end + class DynamicSkipCheck < SystemCheck::BaseCheck + set_name 'dynamic skip check' + set_skip_reason 'this is a skip reason' + + def skip? + self.skip_reason = 'this is a dynamic skip reason' + true + end + + def check? + raise 'should not execute this' + end + end + class MultiCheck < SystemCheck::BaseCheck set_name 'multi check' @@ -127,6 +141,10 @@ describe SystemCheck::SimpleExecutor do expect(subject.checks.size).to eq(1) end + + it 'errors out when passing multiple items' do + expect { subject << [SimpleCheck, OtherCheck] }.to raise_error(ArgumentError) + end end subject { described_class.new('Test') } @@ -205,10 +223,14 @@ describe SystemCheck::SimpleExecutor do subject.run_check(SkipCheck) end - it 'displays #skip_reason' do + it 'displays .skip_reason' do expect { subject.run_check(SkipCheck) }.to output(/this is a skip reason/).to_stdout end + it 'displays #skip_reason' do + expect { subject.run_check(DynamicSkipCheck) }.to output(/this is a dynamic skip reason/).to_stdout + end + it 'does not execute #check when #skip? is true' do expect_any_instance_of(SkipCheck).not_to receive(:check?) |