def initialize
super
add_exception %r%^\./(?:doc|log|public|tmp|\.git|\.hg|\.svn|framework|gems|schema|\.DS_Store|autotest|bin|.*\.sqlite3|.*\.thor)%
%w[.svn .hg .git .autotest].each { |exception| add_exception(exception) }
clear_mappings
add_mapping %r%^lib\/(.*)\.rb% do |_, m|
files_matching %r%^spec\/#{m[1]}%
end
add_mapping %r%^spec/(spec_helper|shared/.*)\.rb$% do
all_specs
end
add_mapping %r%^spec/.*\.rb$% do |filename, _|
filename
end
add_mapping %r%^app/models/(.*)\.rb$% do |_, m|
spec_for(m[1], 'model')
end
add_mapping %r%^app/helpers/global_helpers\.rb% do
files_matching %r%^spec/(views|controllers|helpers|requests)/.*_spec\.rb$%
end
add_mapping %r%^app/helpers/((.*)_helper(s)?)\.rb% do |_, m|
spec_for(m[1], 'helper')
end
add_mapping %r%^app/views/(.*)/% do |_, m|
spec_for(m[1], 'view')
end
add_mapping %r%^app/controllers/(.*)\.rb$% do |_, m|
if ["application", "exception"].include?(m[1])
files_matching %r%^spec/controllers/.*_spec\.rb$%
else
spec_for(m[1], 'controller')
end
end
add_mapping %r%^config/router.rb$% do
files_matching %r%^spec/(controllers|views|helpers)/.*_spec\.rb$%
end
add_mapping %r%^config/(init|rack|environments/test).*\.rb|database\.yml% do
all_specs
end
end