guard-codeception 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +2 -0
- data/.gitignore +1 -0
- data/.travis.yml +2 -2
- data/README.md +21 -14
- data/lib/guard/codeception/parser.rb +9 -5
- data/lib/guard/codeception/runner.rb +1 -1
- data/lib/guard/codeception/version.rb +1 -1
- data/spec/fixtures/results/codeception_failure +13 -8
- data/spec/fixtures/results/codeception_success +4 -3
- data/spec/guard/codeception/parser_spec.rb +23 -1
- data/spec/guard/codeception/runner_spec.rb +5 -0
- data/spec/spec_helper.rb +2 -4
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f28c3b7ad2f96f0a969b1361d205ba3c2e8060eb
|
4
|
+
data.tar.gz: 96275c083e419679dd74d2b3f9abc9824ffb9774
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee7f618ca6de36043f2f15bead54b27a4fdfc5f7103fe12b55b8aec3640dbbc621b91c96d600263e6dbb48cd2f2b0758da210d5815f2e7bf0c58fb909250187c
|
7
|
+
data.tar.gz: 09accc32f01f06905cbddf1c7c0b6de23cf88d65acb5456f19d1d8f68fa21944935677ddef918cb0b30d90f77d02106674829e8b03c98ba13c5f050edac82421
|
data/.coveralls.yml
ADDED
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
rvm:
|
2
2
|
- 1.9.3
|
3
3
|
- 2.0.0
|
4
|
-
- 2.1.
|
4
|
+
- 2.1.1
|
5
5
|
before_script:
|
6
6
|
- echo "yes" | sudo add-apt-repository ppa:ondrej/php5
|
7
7
|
- sudo apt-get update
|
8
|
-
- sudo apt-get install php5 php5-curl
|
8
|
+
- sudo apt-get install php5-cli php5-curl -y
|
9
9
|
- cd spec/fixtures/codeception
|
10
10
|
- curl -sS https://getcomposer.org/installer | php
|
11
11
|
- php composer.phar install --dev
|
data/README.md
CHANGED
@@ -1,18 +1,23 @@
|
|
1
|
-
# Guard::Codeception [![Build Status](https://travis-ci.org/colby-swandale/guard-codeception.png?branch=master)](https://travis-ci.org/colby-swandale/guard-codeception)
|
1
|
+
# Guard::Codeception [![Build Status](https://travis-ci.org/colby-swandale/guard-codeception.png?branch=master)](https://travis-ci.org/colby-swandale/guard-codeception) [![Coverage Status](https://coveralls.io/repos/colby-swandale/guard-codeception/badge.png)](https://coveralls.io/r/colby-swandale/guard-codeception)
|
2
2
|
|
3
3
|
Guard::Codeception is an extension to the [guard gem](http://guardgem.org/) for the [codeception](http://codeception.com/) testing framework
|
4
4
|
|
5
5
|
## Installation
|
6
|
+
```
|
7
|
+
$ gem install guard-codeception
|
8
|
+
```
|
6
9
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
10
|
+
Or add this line to your application's Gemfile:
|
11
|
+
```ruby
|
12
|
+
gem 'guard-codeception'
|
13
|
+
```
|
11
14
|
And then execute:
|
15
|
+
```
|
16
|
+
$ bundle
|
17
|
+
```
|
12
18
|
|
13
|
-
|
14
|
-
|
15
|
-
## Example Guardfle
|
19
|
+
## Guardfle
|
20
|
+
The Guardfile can be generated from `$ guard init codeception`. By default Guard::Codeception will listen to any changes to PHP files only but you can alter the regex to your needs.
|
16
21
|
|
17
22
|
```ruby
|
18
23
|
guard 'codeception' do
|
@@ -48,9 +53,6 @@ The following options can be passed to Guard::Codeception
|
|
48
53
|
```
|
49
54
|
|
50
55
|
## Usage
|
51
|
-
- Make sure you have codeception installed in your project via [composer](http://getcomposer.org/)
|
52
|
-
- Create Guardfile, see example above
|
53
|
-
|
54
56
|
```bash
|
55
57
|
$ guard
|
56
58
|
```
|
@@ -59,9 +61,14 @@ $ guard
|
|
59
61
|
|
60
62
|
1. Fork it
|
61
63
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
62
|
-
3.
|
63
|
-
4.
|
64
|
-
5.
|
64
|
+
3. Test your changes with `rspec`
|
65
|
+
4. Commit your changes (`git commit -am 'Add some feature'`)
|
66
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
67
|
+
6. Create new Pull Request
|
68
|
+
|
69
|
+
|
70
|
+
## Testing
|
71
|
+
You need to pull codeception from composer under `spec/fixtures/codeception` with `composer install --dev`, then run `rspec`.
|
65
72
|
|
66
73
|
## Author
|
67
74
|
|
@@ -4,17 +4,21 @@ module Guard
|
|
4
4
|
|
5
5
|
def parse(text)
|
6
6
|
{
|
7
|
-
tests: _get(text, '
|
8
|
-
failures: _get(text, '
|
9
|
-
assertions: _get(text, '
|
10
|
-
errors: _get(text, '
|
7
|
+
tests: _get(text, 'tests'),
|
8
|
+
failures: _get(text, 'failures'),
|
9
|
+
assertions: _get(text, 'assertions'),
|
10
|
+
errors: _get(text, 'errors')
|
11
11
|
}
|
12
12
|
end
|
13
13
|
|
14
14
|
private
|
15
15
|
|
16
16
|
def _get (text, find)
|
17
|
-
|
17
|
+
begin
|
18
|
+
text.to_s.match(/(FAILURES!\n|OK ).*?(?<count>\d+)? ?#{find.to_s}?(: (?<count>\d+))?/i)[:count].to_i
|
19
|
+
rescue NoMethodError
|
20
|
+
0
|
21
|
+
end
|
18
22
|
end
|
19
23
|
|
20
24
|
end
|
@@ -25,7 +25,7 @@ module Guard
|
|
25
25
|
def _run
|
26
26
|
UI.info 'Codeception: Starting Tests. Results will be displayed when finished testing.'
|
27
27
|
output = _execute_command _codeception_command
|
28
|
-
notifier.notify(parser.parse(output))
|
28
|
+
notifier.notify(parser.parse(output))
|
29
29
|
output
|
30
30
|
end
|
31
31
|
|
@@ -1,8 +1,9 @@
|
|
1
1
|
Codeception PHP Testing Framework v1.8.1
|
2
2
|
Powered by PHPUnit 3.7.28 by Sebastian Bergmann.
|
3
3
|
|
4
|
-
Acceptance Tests (
|
5
|
-
Running (
|
4
|
+
Acceptance Tests (2) ------------------------
|
5
|
+
Running (index2Cept.php) Running index2Cept.php Fail
|
6
|
+
Running (indexCept.php) Running indexCept.php Ok
|
6
7
|
---------------------------------------------
|
7
8
|
|
8
9
|
Functional Tests (0) ------------------------
|
@@ -12,18 +13,22 @@ Unit Tests (0) ------------------------------
|
|
12
13
|
---------------------------------------------
|
13
14
|
|
14
15
|
|
15
|
-
Time:
|
16
|
+
Time: 131 ms, Memory: 11.00Mb
|
16
17
|
|
17
18
|
There was 1 failure:
|
18
19
|
|
19
20
|
---------
|
20
|
-
1)
|
21
|
-
Sorry, I couldn't see "
|
22
|
-
|
21
|
+
1) index2Cept.php
|
22
|
+
Sorry, I couldn't see "NonExist Title","h1":
|
23
|
+
'h1' selector.
|
24
|
+
Failed asserting that
|
25
|
+
--> /Hello World
|
26
|
+
--> contains "nonexist title".
|
23
27
|
|
24
28
|
Scenario Steps:
|
25
|
-
2. I see "
|
29
|
+
2. I see "NonExist Title","h1"
|
26
30
|
1. I am on page "/"
|
27
31
|
|
28
32
|
|
29
|
-
FAILURES!
|
33
|
+
FAILURES!
|
34
|
+
Tests: 2, Assertions: 2, Failures: 1.
|
@@ -1,7 +1,8 @@
|
|
1
1
|
Codeception PHP Testing Framework v1.8.1
|
2
2
|
Powered by PHPUnit 3.7.28 by Sebastian Bergmann.
|
3
3
|
|
4
|
-
Acceptance Tests (
|
4
|
+
Acceptance Tests (2) ------------------------
|
5
|
+
Running (index2Cept.php) Running index2Cept.php Ok
|
5
6
|
Running (indexCept.php) Running indexCept.php Ok
|
6
7
|
---------------------------------------------
|
7
8
|
|
@@ -12,6 +13,6 @@ Unit Tests (0) ------------------------------
|
|
12
13
|
---------------------------------------------
|
13
14
|
|
14
15
|
|
15
|
-
Time:
|
16
|
+
Time: 132 ms, Memory: 10.75Mb
|
16
17
|
|
17
|
-
OK (
|
18
|
+
OK (2 tests, 2 assertions)
|
@@ -3,6 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Guard::Codeception::Parser do
|
4
4
|
|
5
5
|
describe '#parse' do
|
6
|
+
|
6
7
|
it 'should give 0 if nothing exists in the tests' do
|
7
8
|
results = subject.parse('')
|
8
9
|
results.each do |key, value|
|
@@ -10,11 +11,32 @@ describe Guard::Codeception::Parser do
|
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
14
|
+
context 'when codecept tests pass' do
|
15
|
+
|
16
|
+
let (:codecept) { IO.read(Dir.getwd + '/spec/fixtures/results/codeception_success') }
|
17
|
+
|
18
|
+
it 'parses the codecept run results' do
|
19
|
+
result = subject.parse(codecept)
|
20
|
+
expect(result).to eq({tests: 2, assertions: 2, failures: 0, errors: 0})
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'when codecept tests fail' do
|
25
|
+
|
26
|
+
let (:codecept) { IO.read(Dir.getwd + '/spec/fixtures/results/codeception_failure') }
|
27
|
+
|
28
|
+
it 'parses the codecept run results' do
|
29
|
+
result = subject.parse(codecept)
|
30
|
+
expect(result).to eq({tests: 2, assertions: 2, failures: 1, errors: 0})
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
13
35
|
it 'should give values if they exists' do
|
14
36
|
keys = [:tests, :assertions, :failures, :errors]
|
15
37
|
|
16
38
|
keys.each do |key|
|
17
|
-
results = subject.parse("
|
39
|
+
results = subject.parse("OK #{key.to_s.capitalize}: 42 bar")
|
18
40
|
results[key].should eq(42)
|
19
41
|
end
|
20
42
|
|
@@ -26,6 +26,11 @@ describe Guard::Codeception::Runner do
|
|
26
26
|
runner.run
|
27
27
|
end
|
28
28
|
|
29
|
+
it 'notifies guard of result' do
|
30
|
+
::Guard::Notifier.should_receive(:notify)
|
31
|
+
runner.run
|
32
|
+
end
|
33
|
+
|
29
34
|
it 'calls system commands' do
|
30
35
|
runner.should_receive(:`).twice # codeception check, command
|
31
36
|
::Guard::UI.should_receive(:info)
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-codeception
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
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-
|
11
|
+
date: 2014-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|
@@ -73,6 +73,7 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
+
- .coveralls.yml
|
76
77
|
- .gitignore
|
77
78
|
- .rspec
|
78
79
|
- .travis.yml
|
@@ -138,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
139
|
version: '0'
|
139
140
|
requirements: []
|
140
141
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.
|
142
|
+
rubygems_version: 2.0.14
|
142
143
|
signing_key:
|
143
144
|
specification_version: 4
|
144
145
|
summary: guard-codeception automatically runs codeception on file changes
|
@@ -173,4 +174,3 @@ test_files:
|
|
173
174
|
- spec/guard/codeception/runner_spec.rb
|
174
175
|
- spec/guard/codeception_spec.rb
|
175
176
|
- spec/spec_helper.rb
|
176
|
-
has_rdoc:
|