Class: Attest::TestContainer
Instance Attribute Summary collapse
-
#after ⇒ Object
Returns the value of attribute after.
-
#before ⇒ Object
Returns the value of attribute before.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#test_objects ⇒ Object
readonly
Returns the value of attribute test_objects.
Instance Method Summary collapse
- #add(test) ⇒ Object
- #execute_all ⇒ Object
-
#initialize(description) ⇒ TestContainer
constructor
A new instance of TestContainer.
Constructor Details
#initialize(description) ⇒ TestContainer
Returns a new instance of TestContainer.
9 10 11 12 13 |
# File 'lib/attest/test_container.rb', line 9 def initialize(description) @file = Attest.current_file @description = description @test_objects = [] end |
Instance Attribute Details
#after ⇒ Object
Returns the value of attribute after.
7 8 9 |
# File 'lib/attest/test_container.rb', line 7 def after @after end |
#before ⇒ Object
Returns the value of attribute before.
7 8 9 |
# File 'lib/attest/test_container.rb', line 7 def before @before end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
6 7 8 |
# File 'lib/attest/test_container.rb', line 6 def description @description end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
6 7 8 |
# File 'lib/attest/test_container.rb', line 6 def file @file end |
#test_objects ⇒ Object (readonly)
Returns the value of attribute test_objects.
6 7 8 |
# File 'lib/attest/test_container.rb', line 6 def test_objects @test_objects end |
Instance Method Details
#add(test) ⇒ Object
15 16 17 |
# File 'lib/attest/test_container.rb', line 15 def add(test) @test_objects << test end |
#execute_all ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/attest/test_container.rb', line 19 def execute_all Attest.output_writer.before_container(self) container_context = Attest::ExecutionContext.new begin container_context.instance_eval(&@before) if @before @test_objects.each do |test_object| test_object.run container_context end container_context.instance_eval(&@after) if @after rescue => e Attest.output_writer.an_error(e) Attest.output_writer.ignore_container(self) end Attest.output_writer.after_container(self) end |