Class: Minitest::Covers::ExampleAdapter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(test) ⇒ ExampleAdapter

Returns a new instance of ExampleAdapter.



11
12
13
14
15
16
17
18
19
20
# File 'lib/minitest/covers.rb', line 11

def initialize(test)
  @test = test
  file, line = source_location
  @metadata = test.class.(test.name).merge(
    id: id,
    file_path: file,
    line_number: line
  )
  @full_description = "#{test.class}##{test.name}"
end

Instance Attribute Details

#full_descriptionObject (readonly)

Returns the value of attribute full_description.



9
10
11
# File 'lib/minitest/covers.rb', line 9

def full_description
  @full_description
end

#metadataObject (readonly)

Returns the value of attribute metadata.



9
10
11
# File 'lib/minitest/covers.rb', line 9

def 
  @metadata
end

Instance Method Details

#exceptionObject



26
27
28
# File 'lib/minitest/covers.rb', line 26

def exception
  @test.failures.first if @test.respond_to?(:failures)
end

#idObject



22
23
24
# File 'lib/minitest/covers.rb', line 22

def id
  "#{@test.class}##{@test.name}"
end