Class: Autotest::Gem
- Inherits:
-
Autotest
- Object
- Autotest
- Autotest::Gem
- Defined in:
- lib/autotest/gem.rb
Instance Method Summary collapse
-
#initialize ⇒ Gem
constructor
:nodoc:.
-
#path_to_classname(s) ⇒ Object
Convert the pathname s to the name of class.
Constructor Details
#initialize ⇒ Gem
:nodoc:
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/autotest/gem.rb', line 4 def initialize # :nodoc: super add_exception %r%^\./(?:db|doc|log|public|script|tmp|vendor)% clear_mappings add_mapping %r%^lib/(.*)\.rb$% do |_, m| ["test/#{m[1].gsub(/\//,"_")}_test.rb"] end add_mapping %r%^test/factories/(.*)_factory.rb% do |_, m| ["test/#{m[1]}_test.rb"] end add_mapping %r%^test/(.*)_test.rb% do |_, m| ["test/#{m[1]}_test.rb"] end add_mapping %r%^test/fixtures/(.*)s.yml% do |_, m| files_matching %r%^test/.*_test\.rb$% end add_mapping %r%^test/factories.rb|test/blueprints.rb|test/test_helper.rb|(.*)\.gemspec% do files_matching %r%^test/.*_test\.rb$% end end |
Instance Method Details
#path_to_classname(s) ⇒ Object
Convert the pathname s to the name of class.
38 39 40 41 42 43 44 |
# File 'lib/autotest/gem.rb', line 38 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('::') end |