lib/autotest/rails.rb in autotest-rails-pure-4.1.0 vs lib/autotest/rails.rb in autotest-rails-pure-4.1.1
- old
+ new
@@ -69,14 +69,18 @@
add_mapping %r%^test/test_helper.rb|config/((boot|environment(s/test)?).rb|database.yml)% do
files_matching %r%^test/(unit|controllers|views|functional)/.*_test\.rb$%
end
end
+ def ignored_namespaces
+ 'unit|functional|integration|views|controllers|helpers|cells'
+ end
+
# Convert the pathname s to the name of class.
def path_to_classname(s)
sep = File::SEPARATOR
- f = s.sub(/^test#{sep}((unit|functional|integration|views|controllers|helpers)#{sep})?/, '').sub(/\.rb$/, '').split(sep)
- f = f.map { |path| path.split(/_/).map { |seg| seg.capitalize }.join }
- f = f.map { |path| path =~ /Test$/ ? path : "#{path}Test" }
- f.join('::')
+ parts = s.sub(/^test#{sep}((#{ignored_namespaces})#{sep})?/, '').sub(/\.rb$/, '').split(sep)
+ modules = parts.map { |path| path.split(/_/).map { |seg| seg.capitalize }.join }
+ modules = modules.map { |path| path =~ /Test$/ ? path : "#{path}Test" }
+ modules.join('::')
end
end