Class: Rutabaga::Util

Inherits:
Object
  • Object
show all
Defined in:
lib/rutabaga/util.rb

Class Method Summary collapse

Class Method Details

.build_scenario_groups(feature_file) ⇒ Object



55
56
57
# File 'lib/rutabaga/util.rb', line 55

def build_scenario_groups(feature_file)
  [Turnip::Builder.build(feature_file)]
end

.find_feature(description) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/rutabaga/util.rb', line 25

def find_feature(description)
  tried = []

  if description.respond_to?(:=~) && description =~ /.*\.(feature|rutabaga)\Z/
    return description if File.exist?(description)

    tried << description

    candidate = File.join(extract_directory, description)
    return candidate if File.exist?(candidate)

    tried << candidate
  else
    feature_files = extract_features
    feature_files.each do |feature_file|
      return feature_file if File.exist?(feature_file)
    end
    tried += feature_files
  end

  raise "Feature file not found. Tried: #{tried.join(', ')}"
end

.require_if_exists(filename) ⇒ Object



48
49
50
51
52
53
# File 'lib/rutabaga/util.rb', line 48

def require_if_exists(filename)
  require filename
rescue LoadError => e
  # Don't hide LoadErrors raised in the spec helper.
  raise unless e.message.include?(filename)
end