Module: Beaker::DSL::Structure
- Included in:
- Beaker::DSL
- Defined in:
- lib/beaker/dsl/structure.rb
Overview
These are simple structural elements necessary for writing understandable tests and ensuring cleanup actions happen. If using a third party test runner they are unnecessary.
To include this in your own test runner a method #logger should be available to yield a logger that implements Logger‘s interface. As well as a method #teardown_procs that yields an array.
Instance Method Summary collapse
-
#step(step_name, &block) ⇒ Object
Provides a method to help structure tests into coherent steps.
-
#teardown(&block) ⇒ Object
Declare a teardown process that will be called after a test case is complete.
-
#test_name(my_name, &block) ⇒ Object
Provides a method to name tests.
Instance Method Details
#step(step_name, &block) ⇒ Object
Provides a method to help structure tests into coherent steps.
33 34 35 36 |
# File 'lib/beaker/dsl/structure.rb', line 33 def step step_name, &block logger.notify "\n * #{step_name}\n" yield if block_given? end |
#teardown(&block) ⇒ Object
Declare a teardown process that will be called after a test case is complete.
58 59 60 |
# File 'lib/beaker/dsl/structure.rb', line 58 def teardown &block @teardown_procs << block end |
#test_name(my_name, &block) ⇒ Object
Provides a method to name tests.
44 45 46 47 |
# File 'lib/beaker/dsl/structure.rb', line 44 def test_name my_name, &block logger.notify "\n#{my_name}\n" yield if block_given? end |