Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2017-02-20 16:01:37 +0300
committerGabriel Mazetto <brodock@gmail.com>2017-05-31 15:33:03 +0300
commit45378bdd3aae75cb155677d91be61e3d39f5f515 (patch)
tree8d999c9ffbc851cd5899a78c27a8808c34768df6 /spec/lib/system_check
parentbc6d131b74ba4cdf7acadea5a5b7d23f083f47ed (diff)
Added specs for BaseExecutor
Diffstat (limited to 'spec/lib/system_check')
-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