class Shoot::ScenarioRunner

Attributes

klass[R]

Public Class Methods

new(scenario, browser = nil) click to toggle source
# File lib/shoot/scenario_runner.rb, line 4
def initialize(scenario, browser = nil)
  @klass = get_const_from_file(scenario)
  @instance = @klass.new(browser)
end

Public Instance Methods

each_method() { |method| ... } click to toggle source
# File lib/shoot/scenario_runner.rb, line 13
def each_method
  @klass.instance_methods(false).each do |method|
    yield(method)
  end
  @instance.quit
end
platform_name() click to toggle source
# File lib/shoot/scenario_runner.rb, line 9
def platform_name
  @instance.platform_name
end
run(method) click to toggle source
# File lib/shoot/scenario_runner.rb, line 20
def run(method)
  @instance.run(method)
end

Private Instance Methods

constantize_file_name(file) click to toggle source
# File lib/shoot/scenario_runner.rb, line 30
def constantize_file_name(file)
  klass_name = File.basename(file, '.rb').split('_').map(&:capitalize).join
  Kernel.const_get(klass_name)
end
get_const_from_file(file) click to toggle source
# File lib/shoot/scenario_runner.rb, line 35
def get_const_from_file(file)
  require_file(file)
  constantize_file_name(file)
end
require_file(file) click to toggle source
# File lib/shoot/scenario_runner.rb, line 26
def require_file(file)
  require Dir.pwd + '/' + file
end