class Object

Public Instance Methods

_get_test_name() click to toggle source

Find the first call stack entry that looks like: …/test/xxx-yyy.rb and return 'test_xxx_yyy' as the test name.

# File lib/testml/lite.rb, line 210
def _get_test_name
  name = caller.map { |s|
    s.split(':').first
  }.grep(/(^|\/)test\/[-\w]+\.rb$/).first or fail
  name.gsub!(/^(?:.*\/)?test\/([-\w+]+)\.rb$/, '\1').gsub(/[^\w]+/, '_')
  return "test_#{name}"
end