summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorjftucker <jftucker@gmail.com>2008-06-25 13:20:29 +0200
committerjftucker <jftucker@gmail.com>2008-06-25 13:20:29 +0200
commitdc98c5c7b534395416550e3a7e1126a6de6c3c70 (patch)
treea3a1200a4f4da828c753556f0b2023fad4d6c69a /lib
parent16fec95e34ffb192d726dbb9bc56979d978ab98a (diff)
downloadbacon-dc98c5c7b534395416550e3a7e1126a6de6c3c70.tar.gz
bacon-dc98c5c7b534395416550e3a7e1126a6de6c3c70.tar.xz
bacon-dc98c5c7b534395416550e3a7e1126a6de6c3c70.zip
support mappings for subdirs in autotest
darcs-hash:20080625112029-28a3f-a8620aecf68d46cf0aeecb475e57fb52b864d0b8.gz
Diffstat (limited to 'lib')
-rw-r--r--lib/autotest/bacon.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/autotest/bacon.rb b/lib/autotest/bacon.rb
index d2e3be0..a0640bb 100644
--- a/lib/autotest/bacon.rb
+++ b/lib/autotest/bacon.rb
@@ -6,7 +6,16 @@ Autotest.add_hook :initialize do |att|
   end
 
   att.add_mapping(%r%^lib/(.*)\.rb$%) do |filename, m|
-    ["test/test_#{m[1]}.rb", "test/spec_#{m[1]}.rb", "spec/spec_#{m[1]}.rb"]
+    lib_path = m[1]
+    spec = File.basename(lib_path)
+    path = File.dirname(lib_path)
+    [
+      "test/#{path}/test_#{spec}.rb",
+      "test/#{path}/spec_#{spec}.rb",
+      "spec/#{path}/spec_#{spec}.rb",
+      # TODO : decide if the follow 'rspec style' name should be allowed?
+      # "spec/#{path}/#{spec}_spec.rb"
+    ]
   end
 
   false