class Guard::Codeception::Runner

Constants

CODECEPTION_ERRORS_EXIT_CODE
CODECEPTION_FAILURES_EXIT_CODE

Attributes

notifier[RW]
options[RW]
parser[RW]

Public Class Methods

new(options = {}) click to toggle source
# File lib/guard/codeception/runner.rb, line 13
def initialize(options = {})
  @options  = options
  @parser   = Guard::Codeception::Parser.new
  @notifier = Guard::Codeception::Notifier.new
end

Public Instance Methods

run() click to toggle source
# File lib/guard/codeception/runner.rb, line 19
def run
  _run if _codeception_exists?
end

Private Instance Methods

_codeception_command() click to toggle source
# File lib/guard/codeception/runner.rb, line 40
def _codeception_command
  cmd = []

  cmd << options[:codecept]
  cmd << 'run'
  cmd << options[:suites].join(',')
  cmd << '-g ' + options[:groups].join(' -g ') unless options[:groups].empty?
  cmd << '--debug' if options[:debug]
  cmd << options[:cli] if options[:cli]

  cmd.join ' '
end
_codeception_exists?() click to toggle source
# File lib/guard/codeception/runner.rb, line 32
def _codeception_exists?
  %x(#{options[:codecept]} --version)
  true
rescue Errno::ENOENT
  UI.error "codecept isn't available at #{options[:codecept]}, have you installed codeception?"
  false
end
_execute_command(command) click to toggle source
# File lib/guard/codeception/runner.rb, line 53
def _execute_command(command)
  %x{#{command}}
end
_run() click to toggle source
# File lib/guard/codeception/runner.rb, line 25
def _run
  UI.info 'Codeception: Starting Tests. Results will be displayed when finished testing.'
  output = _execute_command _codeception_command
  notifier.notify(parser.parse(output))
  output
end