Class: Campa::Core::Test
- Inherits:
-
Object
- Object
- Campa::Core::Test
- Defined in:
- lib/campa/core/test.rb
Overview
Searches functions with prefix test_ or test- (case insenstive) in a given context, invoke those and store their results in a Data Structure with the given form:
(
(success, (test-one, test-two)),
(failures, (test-three, test-four))
)
In this example we are considering that functions test-one and test-two returned true and functions test-three and test-four returned false.
Instance Method Summary collapse
-
#call(*tests, env:) ⇒ Object
Execute functions named test-* or test_* (case insentive) and collect the results.
-
#initialize ⇒ Test
constructor
A new instance of Test.
Constructor Details
Instance Method Details
#call(*tests, env:) ⇒ Object
Execute functions named test-* or test_* (case insentive) and collect the results.
The param tests can be used to filter specific tests to be executed. For a context where functions test-great-one, test-great-two and test-awful exists, if we want to execute only the great ones, we could do:
38 39 40 41 42 43 44 |
# File 'lib/campa/core/test.rb', line 38 def call(*tests, env:) summary = execute_all(tests, env) List.new( List.new(Symbol.new("success"), List.new(*summary[:success])), List.new(Symbol.new("failures"), List.new(*summary[:failures])) ) end |