lib/guard/rspec/inspector.rb in guard-rspec-0.4.1 vs lib/guard/rspec/inspector.rb in guard-rspec-0.4.2
- old
+ new
@@ -7,10 +7,18 @@
end
def excluded=(glob)
@excluded = Dir[glob.to_s]
end
+
+ def spec_paths
+ @spec_paths || []
+ end
+
+ def spec_paths=(path_array)
+ @spec_paths = path_array
+ end
def clean(paths)
paths.uniq!
paths.compact!
clear_spec_files_list_after do
@@ -28,14 +36,15 @@
def spec_file?(path)
spec_files.include?(path)
end
def spec_folder?(path)
- path.match(%r{^spec[^\.]*$})
+ path.match(%r{^(#{spec_paths.join("|")})[^\.]*$})
+ # path.match(%r{^spec[^\.]*$})
end
def spec_files
- @spec_files ||= Dir["spec/**/*_spec.rb"]
+ @spec_files ||= spec_paths.collect { |path| Dir[File.join(path, "**", "*_spec.rb")] }.flatten
end
def clear_spec_files_list_after
yield
@spec_files = nil