From dc98c5c7b534395416550e3a7e1126a6de6c3c70 Mon Sep 17 00:00:00 2001 From: jftucker Date: Wed, 25 Jun 2008 13:20:29 +0200 Subject: support mappings for subdirs in autotest darcs-hash:20080625112029-28a3f-a8620aecf68d46cf0aeecb475e57fb52b864d0b8.gz --- lib/autotest/bacon.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib') 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 -- cgit 1.4.1