diff options
Diffstat (limited to 'spec/lib/system_check/simple_executor_spec.rb')
-rw-r--r-- | spec/lib/system_check/simple_executor_spec.rb | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/spec/lib/system_check/simple_executor_spec.rb b/spec/lib/system_check/simple_executor_spec.rb index a5c6170cd7d..025ea2673b4 100644 --- a/spec/lib/system_check/simple_executor_spec.rb +++ b/spec/lib/system_check/simple_executor_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' require 'rake_helper' -describe SystemCheck::SimpleExecutor, lib: true do +describe SystemCheck::SimpleExecutor do class SimpleCheck < SystemCheck::BaseCheck set_name 'my simple check' @@ -75,6 +75,24 @@ describe SystemCheck::SimpleExecutor, lib: true do end end + class BugousCheck < SystemCheck::BaseCheck + CustomError = Class.new(StandardError) + set_name 'my bugous check' + + def check? + raise CustomError, 'omg' + end + end + + before do + @rainbow = Rainbow.enabled + Rainbow.enabled = false + end + + after do + Rainbow.enabled = @rainbow + end + describe '#component' do it 'returns stored component name' do expect(subject.component).to eq('Test') @@ -219,5 +237,11 @@ describe SystemCheck::SimpleExecutor, lib: true do end end end + + context 'when there is an exception' do + it 'rescues the exception' do + expect{ subject.run_check(BugousCheck) }.not_to raise_exception + end + end end end |