summaryrefslogtreecommitdiff
path: root/spec/lib/system_check
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-09-06 09:02:47 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-09-06 09:02:47 +0000
commit446c7fc6f190ac8b8bb879a2a5be37c95fafdd13 (patch)
tree0e7d39c1f7b70c71316074a3f4478293f7d27c45 /spec/lib/system_check
parent6ec157264d939ca5c0a1b6c373d76aaf6edeeef1 (diff)
parent71000b394bb7ddf46d3037d62607d159706530f7 (diff)
downloadgitlab-ce-446c7fc6f190ac8b8bb879a2a5be37c95fafdd13.tar.gz
Merge branch 'system-checks-incoming-email' into 'master'
Move Incoming Email checks to System Checks See merge request !14028
Diffstat (limited to 'spec/lib/system_check')
-rw-r--r--spec/lib/system_check/simple_executor_spec.rb24
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?)