Sha256: 39843fe31fd2e2589b8d43f70bde7d89543d7404eeb894c2260fe7c07f63e58c

Contents?: true

Size: 748 Bytes

Versions: 52

Compression:

Stored size: 748 Bytes

Contents

class Autotest
  ##
  # Convert a path in a string, s, into a class name, changing
  # underscores to CamelCase, etc.
 
  def path_to_classname(s)
    sep = File::SEPARATOR
    f = s.sub(/^test#{sep}/, '').sub(/\.rb$/, '').split(sep)
    f = f.map { |path| path.split(/_|(\d+)/).map { |seg| seg.capitalize }.join }
    f = f.map { |path| path =~ /Test$/ ? path : "#{path}Test"  }
    f.join('::')
  end
end

Autotest.add_hook :initialize do |at|
  # doesn't seem to work
  # at.clear_mappings
  
  at.add_mapping(/^lib\/.*\.rb$/) do |filename, _|
    possible = File.basename(filename, 'rb').gsub '_', '_?'
    files_matching %r%^test/.*#{possible}_test\.rb$%
  end

  at.add_mapping(/^test.*\/.*_test\.rb$/) do |filename, _|
    filename
  end
end

Version data entries

52 entries across 52 versions & 3 rubygems

Version Path
active_scaffold_vho-3.0.16 .autotest
active_scaffold_vho-3.0.15 .autotest
active_scaffold_vho-3.0.14 .autotest
active_scaffold_vho-3.0.13 .autotest
active_scaffold_vho-3.0.12 .autotest
active_scaffold_vho-3.0.11 .autotest
active_scaffold_vho-3.0.10 .autotest
active_scaffold_vho-3.0.9 .autotest
active_scaffold_vho-3.0.8 .autotest
active_scaffold_vho-3.0.7 .autotest
active_scaffold_vho-3.0.6 .autotest
lockbox_middleware-1.2.1 vendor/plugins/active_scaffold/.autotest