Class: RSpec::Hermetic::Minitest::Example

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/hermetic/minitest.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(test, block) ⇒ Example

Returns a new instance of Example.



19
20
21
22
23
24
25
# File 'lib/rspec/hermetic/minitest.rb', line 19

def initialize(test, block)
  @test = test
  @block = block
  @metadata = {}
  @full_description = "#{test.class}##{test.name}"
  @location = source_location(test)
end

Instance Attribute Details

#exceptionObject (readonly)

Returns the value of attribute exception.



17
18
19
# File 'lib/rspec/hermetic/minitest.rb', line 17

def exception
  @exception
end

#full_descriptionObject (readonly)

Returns the value of attribute full_description.



17
18
19
# File 'lib/rspec/hermetic/minitest.rb', line 17

def full_description
  @full_description
end

#locationObject (readonly)

Returns the value of attribute location.



17
18
19
# File 'lib/rspec/hermetic/minitest.rb', line 17

def location
  @location
end

#metadataObject (readonly)

Returns the value of attribute metadata.



17
18
19
# File 'lib/rspec/hermetic/minitest.rb', line 17

def 
  @metadata
end

Instance Method Details

#reporterObject



36
37
38
# File 'lib/rspec/hermetic/minitest.rb', line 36

def reporter
  nil
end

#runObject



27
28
29
30
31
32
33
34
# File 'lib/rspec/hermetic/minitest.rb', line 27

def run
  result = @block.call
  @exception = result.failures.first if result.respond_to?(:failures) && result.failures.any?
  result
rescue StandardError => error
  @exception = error
  raise
end