Class: Kapnismology::SmokeTest

Inherits:
Object
  • Object
show all
Defined in:
lib/kapnismology/smoke_test.rb

Overview

This is the base class for all the smoke tests. Inherit from this class and implement the result and self.name method

Defined Under Namespace

Classes: NullResult, Result

Constant Summary collapse

DEPLOYMENT_TAG =
'deployment'.freeze
RUNTIME_TAG =
'runtime'.freeze
DEFAULT_TAGS =
[DEPLOYMENT_TAG, RUNTIME_TAG].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.evaluations(allowed_tags, blacklist) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/kapnismology/smoke_test.rb', line 25

def evaluations(allowed_tags, blacklist)
  # We will run any class which categories are in the allowed list
  # and not blacklisted
  runable_tests = smoke_tests.select do |test|
    klass_name = test.name.split('::').last
    !blacklist.include?(klass_name) &&
      !(allowed_tags & test.tags).empty?
  end
  EvaluationCollection.new(runable_tests)
end

.inherited(klass) ⇒ Object



17
18
19
# File 'lib/kapnismology/smoke_test.rb', line 17

def inherited(klass)
  smoke_tests << klass
end

.smoke_testsObject



21
22
23
# File 'lib/kapnismology/smoke_test.rb', line 21

def smoke_tests
  @smoke_tests ||= []
end

.tagsObject



36
37
38
# File 'lib/kapnismology/smoke_test.rb', line 36

def tags
  DEFAULT_TAGS
end

Instance Method Details

#resultObject



12
13
14
# File 'lib/kapnismology/smoke_test.rb', line 12

def result
  raise 'this method has to be implemented in inherited classes'
end