module Gauge::Executor

@api private

Public Class Methods

execute_hooks(hooks, currentExecutionInfo, should_filter) click to toggle source
# File lib/executor.rb, line 36
def self.execute_hooks(hooks, currentExecutionInfo, should_filter)
  hooks.each do |hook|
    if !should_filter || hook[:options][:tags].empty?
      next hook[:block].call(currentExecutionInfo)
    end
    tags = currentExecutionInfo.currentSpec.tags + get_scenario_tags(currentExecutionInfo)
    intersection = (tags & hook[:options][:tags])
    if (hook[:options][:operator] == 'OR' && !intersection.empty?) ||
       (hook[:options][:operator] == 'AND' && intersection.length == hook[:options][:tags].length)
      hook[:block].call(currentExecutionInfo)
    end
  end
  nil
rescue Exception => e
  e
end
execute_step(step, args) click to toggle source
# File lib/executor.rb, line 27
def self.execute_step(step, args)
  si = MethodCache.get_step_info step
  if args.size == 1
    si[:block].call(args[0])
  else
    si[:block].call(args)
  end
end
get_scenario_tags(info) click to toggle source
# File lib/executor.rb, line 53
def self.get_scenario_tags(info)
  !info.currentScenario.nil? ? info.currentScenario.tags : []
end
load_steps(dir) click to toggle source
# File lib/executor.rb, line 15
def self.load_steps(dir)
  Dir["#{dir}/**/*.rb"].each do |x|
    begin
      GaugeLog.debug "Loading step implementations from #{x} dirs"
      ENV['GAUGE_STEP_FILE'] = x
      require x
    rescue Exception => e
      GaugeLog.error "Cannot import #{x}. Reason: #{e.message}"
    end
  end
end