Method: Transpec::FileFinder.base_paths

Defined in:
lib/transpec/file_finder.rb

.base_paths(paths) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/transpec/file_finder.rb', line 21

def base_paths(paths)
  if paths.empty?
    if Dir.exists?('spec')
      ['spec']
    else
      fail ArgumentError, 'Specify target files or directories.'
    end
  else
    if paths.all? { |path| inside_of_current_working_directory?(path) }
      paths
    else
      fail ArgumentError, 'Target path must be inside of the current working directory.'
    end
  end
end