Class: EEtee::Test

Inherits:
Object
  • Object
show all
Includes:
TestBaseExtension
Defined in:
lib/eetee/test.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label, reporter, &block) ⇒ Test

Returns a new instance of Test.



16
17
18
19
20
21
22
# File 'lib/eetee/test.rb', line 16

def initialize(label, reporter, &block)
  @label = label
  @reporter = reporter || raise('missing reporter')
  @reporter.around_test(self) do
    run(&block)
  end
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



12
13
14
# File 'lib/eetee/test.rb', line 12

def label
  @label
end

#reporterObject (readonly)

Returns the value of attribute reporter.



12
13
14
# File 'lib/eetee/test.rb', line 12

def reporter
  @reporter
end

Instance Method Details

#run(&block) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/eetee/test.rb', line 24

def run(&block)
  EEtee.current_test = self
  super(&block)
        
rescue AssertionFailed => err
  err.test = self
  ::Kernel.raise
  
rescue => err
  ::Kernel.raise Error.new(err, self)
ensure
  EEtee.current_test = nil
end