guard-codeception 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49dde6382fde6d091e3b9d5fa9101ff64c495e57
4
- data.tar.gz: 4e8c0d537f330f77f5777d69a0b6dfd34c458c6c
3
+ metadata.gz: f28c3b7ad2f96f0a969b1361d205ba3c2e8060eb
4
+ data.tar.gz: 96275c083e419679dd74d2b3f9abc9824ffb9774
5
5
  SHA512:
6
- metadata.gz: 75dd1708f32b6df6e2d3b51f668b4d3687ff77cba31d00c8554c6a107453a034b45b9b96a9be678e11d6302f988c07f00a1551487ab63b57106078f5ca0030be
7
- data.tar.gz: bba70fe25f8b722cb429c3a0e104c3634440ecc7be60eead568bbd4a6236306f6b7daf1e6ca004e816a9412b6768c769cf3deaffe263105b2f30f615831c44f4
6
+ metadata.gz: ee7f618ca6de36043f2f15bead54b27a4fdfc5f7103fe12b55b8aec3640dbbc621b91c96d600263e6dbb48cd2f2b0758da210d5815f2e7bf0c58fb909250187c
7
+ data.tar.gz: 09accc32f01f06905cbddf1c7c0b6de23cf88d65acb5456f19d1d8f68fa21944935677ddef918cb0b30d90f77d02106674829e8b03c98ba13c5f050edac82421
@@ -0,0 +1,2 @@
1
+ service_name: travis-pro
2
+ repo_token: 7LYbYIEoU7x9iSHULpMbbcge0xUEOIQYb
data/.gitignore CHANGED
@@ -18,3 +18,4 @@ tmp
18
18
  .DS_Store
19
19
  .idea
20
20
  spec/fixtures/codeception/vendor
21
+ spec/fixtures/codeception/tests/_log/
@@ -1,11 +1,11 @@
1
1
  rvm:
2
2
  - 1.9.3
3
3
  - 2.0.0
4
- - 2.1.0
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
- Add this line to your application's Gemfile:
8
-
9
- gem 'guard-codeception'
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
- $ bundle
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. Commit your changes (`git commit -am 'Add some feature'`)
63
- 4. Push to the branch (`git push origin my-new-feature`)
64
- 5. Create new Pull Request
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, 'Tests'),
8
- failures: _get(text, 'Failures'),
9
- assertions: _get(text, 'Assertions'),
10
- errors: _get(text, 'Errors')
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
- text.to_s.match(%r{#{find.to_s}: \d+}).to_s.split(': ')[1].to_i
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)) if $?.success?
28
+ notifier.notify(parser.parse(output))
29
29
  output
30
30
  end
31
31
 
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module CodeceptionVersion
3
- VERSION = '1.2.0'
3
+ VERSION = '1.2.1'
4
4
  end
5
5
  end
@@ -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 (1) ------------------------
5
- Running (indexCept.php) Running indexCept.php Fail
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: 153 ms, Memory: 11.75Mb
16
+ Time: 131 ms, Memory: 11.00Mb
16
17
 
17
18
  There was 1 failure:
18
19
 
19
20
  ---------
20
- 1) indexCept.php
21
- Sorry, I couldn't see "Foo Bar","h2":
22
- CSS or XPath 'h2' was not found on page.
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 "Foo Bar","h2"
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 (1) ------------------------
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: 151 ms, Memory: 12.00Mb
16
+ Time: 132 ms, Memory: 10.75Mb
16
17
 
17
- OK (1 test, 1 assertion)
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("foo #{key.to_s.capitalize}: 42 bar")
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)
@@ -7,10 +7,8 @@ end
7
7
 
8
8
  require 'rspec'
9
9
  require 'guard/codeception'
10
-
11
- #require 'coveralls'
12
-
13
-
10
+ require 'coveralls'
11
+ Coveralls.wear!
14
12
 
15
13
  RSpec.configure do |config|
16
14
  config.treat_symbols_as_metadata_keys_with_true_values = true
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.0
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-01-24 00:00:00.000000000 Z
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.1.11
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: