summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2017-02-20 14:01:37 +0100
committerGabriel Mazetto <brodock@gmail.com>2017-05-31 14:33:03 +0200
commit45378bdd3aae75cb155677d91be61e3d39f5f515 (patch)
tree8d999c9ffbc851cd5899a78c27a8808c34768df6 /spec
parentbc6d131b74ba4cdf7acadea5a5b7d23f083f47ed (diff)
downloadgitlab-ce-45378bdd3aae75cb155677d91be61e3d39f5f515.tar.gz
Added specs for BaseExecutor
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/system_check/base_executor_spec.rb51
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