diff options
author | Gabriel Mazetto <brodock@gmail.com> | 2017-02-20 14:01:37 +0100 |
---|---|---|
committer | Gabriel Mazetto <brodock@gmail.com> | 2017-02-20 14:02:54 +0100 |
commit | 611ed0c8091e85be65f68723c7eced637203ebe8 (patch) | |
tree | 376ee4532686270014f6513e9132eaa25f00c158 | |
parent | 30e7b864d0b2dde9ec9f5eccf18f86693b5fd499 (diff) | |
download | gitlab-ce-28080-system-checks.tar.gz |
Added specs for BaseExecutor28080-system-checks
-rw-r--r-- | spec/lib/system_check/base_executor_spec.rb | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/spec/lib/system_check/base_executor_spec.rb b/spec/lib/system_check/base_executor_spec.rb new file mode 100644 index 00000000000..139f7f3248f --- /dev/null +++ b/spec/lib/system_check/base_executor_spec.rb @@ -0,0 +1,51 @@ +require 'spec_helper' + +describe SystemCheck::BaseExecutor, lib: true do + class SimpleCheck < SystemCheck::BaseCheck + def check? + true + end + end + + class OtherCheck < SystemCheck::BaseCheck + def check? + false + end + end + + subject { described_class.new('Test') } + + describe '#component' do + it 'returns stored component name' do + expect(subject.component).to eq('Test') + end + end + + describe '#checks' do + before do + subject << SimpleCheck + end + + it 'returns an array of classes' do + expect(subject.checks).to include(SimpleCheck) + end + end + + describe '#<<' do + before do + subject << SimpleCheck + end + + it 'appends a new check to the Set' do + subject << OtherCheck + stored_checks = subject.checks.to_a + expect(stored_checks.first).to eq(SimpleCheck) + expect(stored_checks.last).to eq(OtherCheck) + end + + it 'inserts unique itens only' do + subject << SimpleCheck + expect(subject.checks.size).to eq(1) + end + end +end |