Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 771ad9a097
Fetching contributors…

Cannot retrieve contributors at this time

42 lines (31 sloc) 0.982 kb
# vim: syntax=ruby
require 'autotest/restart'
# vim: ft=ruby
Autotest.add_hook :initialize do |at|
at.libs = %w[lib spec].join(File::PATH_SEPARATOR)
at.testlib = 'rspec'
at.add_exception 'coverage.info'
at.add_exception 'coverage'
at.add_exception '.git'
at.clear_mappings
# file in /spec -> run it
at.add_mapping(%r|^spec/.*_spec\.rb$|) do |filename, _|
filename
end
# file in /lib -> run test in /spec
at.add_mapping(%r|^lib/(.*)\.rb$|) do |_, match|
at.files_matching %r|^spec/#{match[1]}_spec.rb|
end
at.add_mapping(%r|^spec/spec_helper\.rb|) do
at.files_matching( %r|^spec/.*_spec\.rb| )
end
# Make the class map for things in lib
class_map = {}
sep = File::SEPARATOR
Dir.glob("lib/**/*.rb").each do |f|
c = f.sub(/lib#{sep}/,'').sub(/\.rb$/,'').split sep
c = c.map { |path| path.split(/_|(\d+)/).map { |seq| seq.capitalize }.join }
class_map[c.join("::")] = f
end
at.extra_class_map = class_map
end
Jump to Line
Something went wrong with that request. Please try again.