Class: Evilution::SpecResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/spec_resolver.rb

Constant Summary collapse

STRIPPABLE_PREFIXES =
%w[lib/ app/].freeze

Instance Method Summary collapse

Instance Method Details

#call(source_path) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/evilution/spec_resolver.rb', line 7

def call(source_path)
  return nil if source_path.nil? || source_path.empty?

  normalized = normalize_path(source_path)
  candidates = candidate_spec_paths(normalized)
  candidates.find { |path| File.exist?(path) }
end

#resolve_all(source_paths) ⇒ Object



15
16
17
# File 'lib/evilution/spec_resolver.rb', line 15

def resolve_all(source_paths)
  Array(source_paths).filter_map { |path| call(path) }.uniq
end