Class: CukeIterations::IterationFileFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/cuke_iterations/iteration_file_finder.rb

Instance Method Summary collapse

Instance Method Details

#find(features_dir, iteration_file = 'cuke_iterations.yml') ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/cuke_iterations/iteration_file_finder.rb', line 3

def find(features_dir, iteration_file = 'cuke_iterations.yml')
  raise 'features_dir cannot be nil' unless features_dir

  iteration_file_locations = [
      iteration_file,
      File.join(features_dir, iteration_file)
  ]

  location = iteration_file_locations.select { |location| File.exist? location }.first

  raise "Couldn't find iterations file, tried the following: #{iteration_file_locations.join(', ')}" unless location
  location
end