Class: Guard::Codeception

Inherits:
Plugin
  • Object
show all
Defined in:
lib/guard/codeception.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{
	:test_on_start 	=> false,
	:suites		=> [:acceptance, :functional, :unit],
	:debug 		=> false,
	:groups 	=> []
}

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Codeception

Returns a new instance of Codeception.



14
15
16
17
# File 'lib/guard/codeception.rb', line 14

def initialize(options = {})
	@options = DEFAULT_OPTIONS.merge(options)
	super(@options)
end

Instance Method Details

#execute(cmd) ⇒ Object



43
44
45
# File 'lib/guard/codeception.rb', line 43

def execute(cmd)
	system cmd
end

#make(cmd_parts) ⇒ Object



39
40
41
# File 'lib/guard/codeception.rb', line 39

def make(cmd_parts)
	cmd_parts.join ' '
end

#runObject



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/guard/codeception.rb', line 27

def run
	cmd = []
	cmd << "vendor/bin/codecept"
	cmd << "run"
	cmd << options[:suites].join(',')
	cmd << '-g ' + options[:groups].join(' -g ') if !options[:groups].empty?
	cmd << '--debug' if options[:debug]

	status = execute make(cmd)
	status
end

#run_on_change(paths) ⇒ Object



23
24
25
# File 'lib/guard/codeception.rb', line 23

def run_on_change(paths)
	puts run
end

#startObject



19
20
21
# File 'lib/guard/codeception.rb', line 19

def start
	puts run if options[:test_on_start]
end