Class: Neospec::Suite
- Inherits:
-
Object
- Object
- Neospec::Suite
- Defined in:
- lib/neospec/suite.rb
Instance Attribute Summary collapse
-
#runner ⇒ Object
Returns the value of attribute runner.
-
#specs ⇒ Object
Returns the value of attribute specs.
Instance Method Summary collapse
- #after(&block) ⇒ Object
- #before(&block) ⇒ Object
- #describe(description, &block) ⇒ Object
-
#initialize(runner: Neospec::Runner::Basic.new) ⇒ Suite
constructor
A new instance of Suite.
- #results ⇒ Object
- #run(logger:) ⇒ Object
- #setup(&block) ⇒ Object
- #teardown(&block) ⇒ Object
Constructor Details
Instance Attribute Details
#runner ⇒ Object
Returns the value of attribute runner.
3 4 5 |
# File 'lib/neospec/suite.rb', line 3 def runner @runner end |
#specs ⇒ Object
Returns the value of attribute specs.
3 4 5 |
# File 'lib/neospec/suite.rb', line 3 def specs @specs end |
Instance Method Details
#after(&block) ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/neospec/suite.rb', line 49 def after(&block) if block_given? @after = block else @after end end |
#before(&block) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/neospec/suite.rb', line 41 def before(&block) if block_given? @before = block else @before end end |
#describe(description, &block) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/neospec/suite.rb', line 18 def describe(description, &block) @specs << Neospec::Spec.new( description: description, block: block ) end |
#results ⇒ Object
14 15 16 |
# File 'lib/neospec/suite.rb', line 14 def results @specs.map(&:result) end |
#run(logger:) ⇒ Object
57 58 59 60 61 62 |
# File 'lib/neospec/suite.rb', line 57 def run(logger:) runner.run( logger: logger, suite: self ) end |
#setup(&block) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/neospec/suite.rb', line 25 def setup(&block) if block_given? @setup = block else @setup end end |
#teardown(&block) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/neospec/suite.rb', line 33 def teardown(&block) if block_given? @teardown = block else @teardown end end |