guard-codeception 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/Gemfile +3 -0
- data/README.md +4 -3
- data/guard-codeception.gemspec +1 -1
- data/lib/guard/codeception/notifier.rb +31 -0
- data/lib/guard/codeception/options.rb +22 -0
- data/lib/guard/codeception/parser.rb +22 -0
- data/lib/guard/codeception/runner.rb +56 -41
- data/lib/guard/codeception/templates/Guardfile +2 -2
- data/lib/guard/codeception/version.rb +1 -1
- data/lib/guard/codeception.rb +40 -30
- data/spec/fixtures/codeception/.gitignore +1 -0
- data/spec/guard/codeception/notifier_spec.rb +54 -0
- data/spec/guard/codeception/options_spec.rb +17 -0
- data/spec/guard/codeception/parser_spec.rb +24 -0
- data/spec/guard/codeception/runner_spec.rb +93 -54
- data/spec/guard/codeception_spec.rb +82 -61
- data/spec/spec_helper.rb +14 -2
- metadata +30 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49dde6382fde6d091e3b9d5fa9101ff64c495e57
|
4
|
+
data.tar.gz: 4e8c0d537f330f77f5777d69a0b6dfd34c458c6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75dd1708f32b6df6e2d3b51f668b4d3687ff77cba31d00c8554c6a107453a034b45b9b96a9be678e11d6302f988c07f00a1551487ab63b57106078f5ca0030be
|
7
|
+
data.tar.gz: bba70fe25f8b722cb429c3a0e104c3634440ecc7be60eead568bbd4a6236306f6b7daf1e6ca004e816a9412b6768c769cf3deaffe263105b2f30f615831c44f4
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
# TODO:
|
2
|
-
- 100% code coverage
|
3
|
-
|
4
1
|
# Guard::Codeception [![Build Status](https://travis-ci.org/colby-swandale/guard-codeception.png?branch=master)](https://travis-ci.org/colby-swandale/guard-codeception)
|
5
2
|
|
6
3
|
Guard::Codeception is an extension to the [guard gem](http://guardgem.org/) for the [codeception](http://codeception.com/) testing framework
|
@@ -70,3 +67,7 @@ $ guard
|
|
70
67
|
|
71
68
|
[Colby Swandale](https://github.com/colby-swandale)
|
72
69
|
|
70
|
+
## Contributors
|
71
|
+
|
72
|
+
[tmuntan1](https://github.com/tmuntan1)
|
73
|
+
|
data/guard-codeception.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
|
20
|
-
spec.add_dependency 'guard', '
|
20
|
+
spec.add_dependency 'guard', '~> 2.0'
|
21
21
|
|
22
22
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
23
23
|
spec.add_development_dependency 'rake'
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Guard
|
2
|
+
class Codeception
|
3
|
+
class Notifier
|
4
|
+
|
5
|
+
TITLE = 'Codeception Results'
|
6
|
+
|
7
|
+
def notify(results)
|
8
|
+
image = _image(results)
|
9
|
+
message = _message(results)
|
10
|
+
::Guard::Notifier::notify(message, {title: TITLE, image: image})
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def _image(results)
|
16
|
+
return :failed if results[:failures] > 0
|
17
|
+
return :failed if results[:errors] > 0
|
18
|
+
:success
|
19
|
+
end
|
20
|
+
|
21
|
+
def _message(results)
|
22
|
+
message = "#{results[:tests]} tests\n"
|
23
|
+
message << "#{results[:assertions]} assertions\n"
|
24
|
+
message << "#{results[:failures]} failures\n"
|
25
|
+
message << "#{results[:errors]} errors\n"
|
26
|
+
message
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Guard
|
2
|
+
class Codeception
|
3
|
+
module Options
|
4
|
+
|
5
|
+
DEFAULTS = {
|
6
|
+
test_on_start: false,
|
7
|
+
suites: [:acceptance, :functional, :unit],
|
8
|
+
debug: false,
|
9
|
+
groups: [],
|
10
|
+
codecept: 'codecept',
|
11
|
+
cli: false
|
12
|
+
}
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def with_defaults(options={})
|
16
|
+
DEFAULTS.merge(options)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Guard
|
2
|
+
class Codeception
|
3
|
+
class Parser
|
4
|
+
|
5
|
+
def parse(text)
|
6
|
+
{
|
7
|
+
tests: _get(text, 'Tests'),
|
8
|
+
failures: _get(text, 'Failures'),
|
9
|
+
assertions: _get(text, 'Assertions'),
|
10
|
+
errors: _get(text, 'Errors')
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def _get (text, find)
|
17
|
+
text.to_s.match(%r{#{find.to_s}: \d+}).to_s.split(': ')[1].to_i
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,44 +1,59 @@
|
|
1
1
|
module Guard
|
2
2
|
class Codeception
|
3
|
+
class Runner
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
5
|
+
require 'guard/codeception/parser'
|
6
|
+
require 'guard/codeception/notifier'
|
7
|
+
|
8
|
+
attr_accessor :options, :parser, :notifier
|
9
|
+
|
10
|
+
CODECEPTION_FAILURES_EXIT_CODE = 1
|
11
|
+
CODECEPTION_ERRORS_EXIT_CODE = 2
|
12
|
+
|
13
|
+
def initialize(options = {})
|
14
|
+
@options = options
|
15
|
+
@parser = Guard::Codeception::Parser.new
|
16
|
+
@notifier = Guard::Codeception::Notifier.new
|
17
|
+
end
|
18
|
+
|
19
|
+
def run
|
20
|
+
_run if _codeception_exists?
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def _run
|
26
|
+
UI.info 'Codeception: Starting Tests. Results will be displayed when finished testing.'
|
27
|
+
output = _execute_command _codeception_command
|
28
|
+
notifier.notify(parser.parse(output)) if $?.success?
|
29
|
+
output
|
30
|
+
end
|
31
|
+
|
32
|
+
def _codeception_exists?
|
33
|
+
%x(#{options[:codecept]} --version)
|
34
|
+
true
|
35
|
+
rescue Errno::ENOENT
|
36
|
+
UI.error "codecept isn't available at #{options[:codecept]}, have you installed codeception?"
|
37
|
+
false
|
38
|
+
end
|
39
|
+
|
40
|
+
def _codeception_command
|
41
|
+
cmd = []
|
42
|
+
|
43
|
+
cmd << options[:codecept]
|
44
|
+
cmd << 'run'
|
45
|
+
cmd << options[:suites].join(',')
|
46
|
+
cmd << '-g ' + options[:groups].join(' -g ') unless options[:groups].empty?
|
47
|
+
cmd << '--debug' if options[:debug]
|
48
|
+
cmd << options[:cli] if options[:cli]
|
49
|
+
|
50
|
+
cmd.join ' '
|
51
|
+
end
|
52
|
+
|
53
|
+
def _execute_command(command)
|
54
|
+
%x{#{command}}
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
guard
|
2
|
-
|
1
|
+
guard :codeception do
|
2
|
+
watch(%r{^.*\.php$})
|
3
3
|
end
|
data/lib/guard/codeception.rb
CHANGED
@@ -2,34 +2,44 @@ require 'guard'
|
|
2
2
|
require 'guard/plugin'
|
3
3
|
|
4
4
|
module Guard
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
5
|
+
class Codeception < Plugin
|
6
|
+
|
7
|
+
require 'guard/codeception/runner'
|
8
|
+
require 'guard/codeception/options'
|
9
|
+
|
10
|
+
attr_accessor :runner, :options
|
11
|
+
|
12
|
+
def initialize(options = {})
|
13
|
+
super
|
14
|
+
@options = Options.with_defaults(options)
|
15
|
+
@runner = Runner.new(@options)
|
16
|
+
end
|
17
|
+
|
18
|
+
def start
|
19
|
+
_show_start_message
|
20
|
+
puts runner.run if _should_test_on_start?
|
21
|
+
end
|
22
|
+
|
23
|
+
def run_on_modifications(paths)
|
24
|
+
puts runner.run
|
25
|
+
end
|
26
|
+
|
27
|
+
def reload
|
28
|
+
end
|
29
|
+
|
30
|
+
def run_all
|
31
|
+
puts runner.run
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def _show_start_message
|
37
|
+
::Guard::UI::info 'Guard::Codeception is running'
|
38
|
+
end
|
39
|
+
|
40
|
+
def _should_test_on_start?
|
41
|
+
options[:test_on_start]
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
35
45
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
vendor
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Guard::Codeception::Notifier do
|
4
|
+
|
5
|
+
let (:results) {
|
6
|
+
{
|
7
|
+
tests: 100,
|
8
|
+
assertions: 1000,
|
9
|
+
errors: 0,
|
10
|
+
failures: 0
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
describe '#notify' do
|
15
|
+
|
16
|
+
it 'should give proper message' do
|
17
|
+
message = "100 tests\n"
|
18
|
+
message << "1000 assertions\n"
|
19
|
+
message << "0 failures\n"
|
20
|
+
message << "0 errors\n"
|
21
|
+
|
22
|
+
::Guard::Notifier::should_receive(:notify).with(message, {image: :success, title: Guard::Codeception::Notifier::TITLE})
|
23
|
+
subject.notify(results)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should give success message' do
|
27
|
+
::Guard::Notifier::should_receive(:notify).with(message(results), {image: :success, title: Guard::Codeception::Notifier::TITLE})
|
28
|
+
subject.notify(results)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should give failed message' do
|
32
|
+
@results = results.merge(failures: 1)
|
33
|
+
::Guard::Notifier::should_receive(:notify).with(message(@results), {image: :failed, title: Guard::Codeception::Notifier::TITLE})
|
34
|
+
subject.notify(@results)
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should give error message' do
|
38
|
+
@results = results.merge(errors: 1)
|
39
|
+
::Guard::Notifier::should_receive(:notify).with(message(@results), {image: :failed, title: Guard::Codeception::Notifier::TITLE})
|
40
|
+
subject.notify(@results)
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
# taken from the class to make testing easier
|
46
|
+
def message(results)
|
47
|
+
message = "#{results[:tests]} tests\n"
|
48
|
+
message << "#{results[:assertions]} assertions\n"
|
49
|
+
message << "#{results[:failures]} failures\n"
|
50
|
+
message << "#{results[:errors]} errors\n"
|
51
|
+
message
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Guard::Codeception::Options do
|
4
|
+
|
5
|
+
describe '#with_defaults' do
|
6
|
+
it 'should have defaults if no overrides are provided' do
|
7
|
+
defaults = subject.with_defaults({})
|
8
|
+
defaults.should eq(Guard::Codeception::Options::DEFAULTS)
|
9
|
+
end
|
10
|
+
it 'should override defaults with provided options' do
|
11
|
+
expected = Guard::Codeception::Options::DEFAULTS.merge({test_on_start: true})
|
12
|
+
defaults = subject.with_defaults({test_on_start: true})
|
13
|
+
defaults.should eq(expected)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Guard::Codeception::Parser do
|
4
|
+
|
5
|
+
describe '#parse' do
|
6
|
+
it 'should give 0 if nothing exists in the tests' do
|
7
|
+
results = subject.parse('')
|
8
|
+
results.each do |key, value|
|
9
|
+
value.should eq(0)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should give values if they exists' do
|
14
|
+
keys = [:tests, :assertions, :failures, :errors]
|
15
|
+
|
16
|
+
keys.each do |key|
|
17
|
+
results = subject.parse("foo #{key.to_s.capitalize}: 42 bar")
|
18
|
+
results[key].should eq(42)
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -2,58 +2,97 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Guard::Codeception::Runner do
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
5
|
+
let (:runner) { Guard::Codeception::Runner.new(
|
6
|
+
{
|
7
|
+
test_on_start: false,
|
8
|
+
suites: [:acceptance],
|
9
|
+
groups: [:group1],
|
10
|
+
debug: false,
|
11
|
+
codecept: Dir.getwd + '/spec/fixtures/codeception/vendor/bin/codecept',
|
12
|
+
cli: '-c ' + Dir.getwd + '/spec/fixtures/codeception/codeception.yml'
|
13
|
+
}
|
14
|
+
) }
|
15
|
+
|
16
|
+
describe '#run' do
|
17
|
+
|
18
|
+
it 'calls #codeception_exists?' do
|
19
|
+
runner.should_receive(:_codeception_exists?)
|
20
|
+
runner.run
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'displays error when codeception does not exist' do
|
24
|
+
runner = Guard::Codeception::Runner.new({codecept: 'foo'})
|
25
|
+
::Guard::UI.should_receive(:error)
|
26
|
+
runner.run
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'calls system commands' do
|
30
|
+
runner.should_receive(:`).twice # codeception check, command
|
31
|
+
::Guard::UI.should_receive(:info)
|
32
|
+
runner.run
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '#_codeception_command' do
|
38
|
+
|
39
|
+
describe 'suites' do
|
40
|
+
it 'should create a proper system command with multiple suites' do
|
41
|
+
test_runner = Guard::Codeception::Runner.new(runner.options.merge({suites: [:unit, :acceptance]}))
|
42
|
+
test_runner.should_receive(:_execute_command).with("#{runner.options[:codecept]} run unit,acceptance -g group1 #{runner.options[:cli]}")
|
43
|
+
::Guard::UI.should_receive(:info)
|
44
|
+
test_runner.run
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe 'groups' do
|
49
|
+
it 'should create a proper system command with multiple groups' do
|
50
|
+
test_runner = Guard::Codeception::Runner.new(runner.options.merge({groups: [:group1, :group2]}))
|
51
|
+
test_runner.should_receive(:_execute_command).with("#{runner.options[:codecept]} run acceptance -g group1 -g group2 #{runner.options[:cli]}")
|
52
|
+
::Guard::UI.should_receive(:info)
|
53
|
+
test_runner.run
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'should create a proper system command with no groups' do
|
57
|
+
test_runner = Guard::Codeception::Runner.new(runner.options.merge({groups: []}))
|
58
|
+
test_runner.should_receive(:_execute_command).with("#{runner.options[:codecept]} run acceptance #{runner.options[:cli]}")
|
59
|
+
::Guard::UI.should_receive(:info)
|
60
|
+
test_runner.run
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe 'debug' do
|
65
|
+
it 'should add debug when needed' do
|
66
|
+
test_runner = Guard::Codeception::Runner.new(runner.options.merge({debug: true}))
|
67
|
+
test_runner.should_receive(:_execute_command).with("#{runner.options[:codecept]} run acceptance -g group1 --debug #{runner.options[:cli]}")
|
68
|
+
::Guard::UI.should_receive(:info)
|
69
|
+
test_runner.run
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'should not add debug when needed' do
|
73
|
+
test_runner = Guard::Codeception::Runner.new(runner.options.merge({debug: false}))
|
74
|
+
test_runner.should_receive(:_execute_command).with("#{runner.options[:codecept]} run acceptance -g group1 #{runner.options[:cli]}")
|
75
|
+
::Guard::UI.should_receive(:info)
|
76
|
+
test_runner.run
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe 'cli' do
|
81
|
+
it 'should add cli option when supplied' do
|
82
|
+
test_runner = Guard::Codeception::Runner.new(runner.options.merge({cli: '-c foo'}))
|
83
|
+
test_runner.should_receive(:_execute_command).with("#{runner.options[:codecept]} run acceptance -g group1 -c foo")
|
84
|
+
::Guard::UI.should_receive(:info)
|
85
|
+
test_runner.run
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'should not add cli option when supplied' do
|
89
|
+
test_runner = Guard::Codeception::Runner.new(runner.options.merge({cli: nil}))
|
90
|
+
test_runner.should_receive(:_execute_command).with("#{runner.options[:codecept]} run acceptance -g group1")
|
91
|
+
::Guard::UI.should_receive(:info)
|
92
|
+
test_runner.run
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
|
59
98
|
end
|
@@ -2,86 +2,107 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Guard::Codeception do
|
4
4
|
|
5
|
-
|
5
|
+
let (:runner) { Guard::Codeception::Runner }
|
6
6
|
|
7
|
-
|
7
|
+
describe '#initialize' do
|
8
8
|
|
9
|
-
|
9
|
+
context 'when no options are provided' do
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
it 'has :test_on_start set to false' do
|
12
|
+
expect(subject.options[:test_on_start]).to be_false
|
13
|
+
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
it 'has :suites set to [:acceptance, :functional, :unit]' do
|
16
|
+
expect(subject.options[:suites]).to match_array([:acceptance, :functional, :unit])
|
17
|
+
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
it 'has :debug set to false' do
|
20
|
+
expect(subject.options[:debug]).to be_false
|
21
|
+
end
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
it 'has :groups set to []' do
|
24
|
+
expect(subject.options[:groups]).to match_array([])
|
25
|
+
end
|
26
|
+
end
|
27
27
|
|
28
|
-
|
28
|
+
context 'when options are provided' do
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
subject do
|
31
|
+
Guard::Codeception.new test_on_start: true, suites: [:foo], debug: true, groups: [:bar]
|
32
|
+
end
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
it 'has :test_on_start set to true' do
|
35
|
+
expect(subject.options[:test_on_start]).to be_true
|
36
|
+
end
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
it 'has suites set to []' do
|
39
|
+
expect(subject.options[:suites]).to match_array([:foo])
|
40
|
+
end
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
it 'has debug set to true' do
|
43
|
+
expect(subject.options[:debug]).to be_true
|
44
|
+
end
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
46
|
+
it 'has groups set to [:foo]' do
|
47
|
+
expect(subject.options[:groups]).to match_array([:bar])
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
51
|
|
52
|
-
|
52
|
+
describe '#start' do
|
53
53
|
|
54
|
-
|
55
|
-
subject.should_not_receive :run
|
56
|
-
subject.start
|
57
|
-
end
|
54
|
+
context 'with :run_on_start set to false' do
|
58
55
|
|
59
|
-
|
56
|
+
subject do
|
57
|
+
Guard::Codeception.new test_on_start: false
|
58
|
+
end
|
60
59
|
|
61
|
-
|
62
|
-
|
63
|
-
|
60
|
+
it 'should\'t call #run' do
|
61
|
+
subject.should_not_receive :run
|
62
|
+
::Guard::UI.should_receive(:info)
|
63
|
+
subject.start
|
64
|
+
end
|
65
|
+
end
|
64
66
|
|
65
|
-
|
66
|
-
subject.should_receive :run
|
67
|
-
subject.start
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
67
|
+
context 'with :run_on_start set to true' do
|
71
68
|
|
72
|
-
|
69
|
+
subject do
|
70
|
+
Guard::Codeception.new test_on_start: true
|
71
|
+
end
|
73
72
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
73
|
+
it 'should call #run' do
|
74
|
+
subject.runner.should_receive :run
|
75
|
+
::Guard::UI.should_receive(:info)
|
76
|
+
subject.start
|
77
|
+
end
|
79
78
|
|
80
|
-
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe '#run_all' do
|
83
|
+
|
84
|
+
subject do
|
85
|
+
Guard::Codeception.new
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'should call #run_all' do
|
89
|
+
subject.runner.should_receive :run
|
90
|
+
subject.run_all
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
describe '#run_on_modification' do
|
96
|
+
|
97
|
+
subject do
|
98
|
+
Guard::Codeception.new
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'should call #run_all' do
|
102
|
+
subject.runner.should_receive :run
|
103
|
+
subject.run_on_modifications []
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
81
107
|
|
82
|
-
it 'should call Runner#run' do
|
83
|
-
runner.should_receive :run
|
84
|
-
subject.run
|
85
|
-
end
|
86
|
-
end
|
87
108
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,21 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
|
3
|
+
SimpleCov.start do
|
4
|
+
add_filter '/spec/'
|
5
|
+
add_group 'Codeception', 'lib/guard'
|
6
|
+
end
|
7
|
+
|
1
8
|
require 'rspec'
|
2
9
|
require 'guard/codeception'
|
3
10
|
|
11
|
+
#require 'coveralls'
|
12
|
+
|
13
|
+
|
14
|
+
|
4
15
|
RSpec.configure do |config|
|
5
16
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
6
|
-
config.run_all_when_everything_filtered
|
17
|
+
config.run_all_when_everything_filtered = true
|
18
|
+
config.order = :random
|
19
|
+
|
7
20
|
config.filter_run :focus
|
8
|
-
config.order = 'random'
|
9
21
|
end
|
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-codeception
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Colby Swandale
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '2.14'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '2.14'
|
69
69
|
description: Guard gem for codeception
|
@@ -73,18 +73,22 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
-
|
77
|
-
-
|
78
|
-
-
|
76
|
+
- .gitignore
|
77
|
+
- .rspec
|
78
|
+
- .travis.yml
|
79
79
|
- Gemfile
|
80
80
|
- LICENSE.txt
|
81
81
|
- README.md
|
82
82
|
- Rakefile
|
83
83
|
- guard-codeception.gemspec
|
84
84
|
- lib/guard/codeception.rb
|
85
|
+
- lib/guard/codeception/notifier.rb
|
86
|
+
- lib/guard/codeception/options.rb
|
87
|
+
- lib/guard/codeception/parser.rb
|
85
88
|
- lib/guard/codeception/runner.rb
|
86
89
|
- lib/guard/codeception/templates/Guardfile
|
87
90
|
- lib/guard/codeception/version.rb
|
91
|
+
- spec/fixtures/codeception/.gitignore
|
88
92
|
- spec/fixtures/codeception/codeception.yml
|
89
93
|
- spec/fixtures/codeception/composer.json
|
90
94
|
- spec/fixtures/codeception/composer.lock
|
@@ -108,6 +112,9 @@ files:
|
|
108
112
|
- spec/fixtures/codeception/tests/unit/_bootstrap.php
|
109
113
|
- spec/fixtures/results/codeception_failure
|
110
114
|
- spec/fixtures/results/codeception_success
|
115
|
+
- spec/guard/codeception/notifier_spec.rb
|
116
|
+
- spec/guard/codeception/options_spec.rb
|
117
|
+
- spec/guard/codeception/parser_spec.rb
|
111
118
|
- spec/guard/codeception/runner_spec.rb
|
112
119
|
- spec/guard/codeception_spec.rb
|
113
120
|
- spec/spec_helper.rb
|
@@ -121,21 +128,22 @@ require_paths:
|
|
121
128
|
- lib
|
122
129
|
required_ruby_version: !ruby/object:Gem::Requirement
|
123
130
|
requirements:
|
124
|
-
- -
|
131
|
+
- - '>='
|
125
132
|
- !ruby/object:Gem::Version
|
126
133
|
version: '0'
|
127
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
135
|
requirements:
|
129
|
-
- -
|
136
|
+
- - '>='
|
130
137
|
- !ruby/object:Gem::Version
|
131
138
|
version: '0'
|
132
139
|
requirements: []
|
133
140
|
rubyforge_project:
|
134
|
-
rubygems_version: 2.
|
141
|
+
rubygems_version: 2.1.11
|
135
142
|
signing_key:
|
136
143
|
specification_version: 4
|
137
144
|
summary: guard-codeception automatically runs codeception on file changes
|
138
145
|
test_files:
|
146
|
+
- spec/fixtures/codeception/.gitignore
|
139
147
|
- spec/fixtures/codeception/codeception.yml
|
140
148
|
- spec/fixtures/codeception/composer.json
|
141
149
|
- spec/fixtures/codeception/composer.lock
|
@@ -159,6 +167,10 @@ test_files:
|
|
159
167
|
- spec/fixtures/codeception/tests/unit/_bootstrap.php
|
160
168
|
- spec/fixtures/results/codeception_failure
|
161
169
|
- spec/fixtures/results/codeception_success
|
170
|
+
- spec/guard/codeception/notifier_spec.rb
|
171
|
+
- spec/guard/codeception/options_spec.rb
|
172
|
+
- spec/guard/codeception/parser_spec.rb
|
162
173
|
- spec/guard/codeception/runner_spec.rb
|
163
174
|
- spec/guard/codeception_spec.rb
|
164
175
|
- spec/spec_helper.rb
|
176
|
+
has_rdoc:
|