guard-phpunit 0.0.1 → 0.0.2

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.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- Guard::PHPUnit
1
+ Guard::PHPUnit [![Build Status](https://secure.travis-ci.org/Maher4Ever/guard-phpunit.png)](http://travis-ci.org/Maher4Ever/guard-phpunit)
2
2
  ==============
3
3
 
4
4
  PHPUnit guard allows to automatically & intelligently launch tests when files
@@ -61,11 +61,11 @@ The following options can be passed to Guard::PHPUnit:
61
61
  :all_on_start => false # Run all tests on startup.
62
62
  # default: true
63
63
 
64
- :tests_path # Relative path to the tests directory. This path
64
+ :tests_path => 'tests' # Relative path to the tests directory. This path
65
65
  # is used when running all the tests.
66
66
  # default: the current working directory (pwd)
67
67
 
68
- :cli # The options passed to the phpunit command
68
+ :cli => '--colors' # The options passed to the phpunit command
69
69
  # when running the tests.
70
70
  # default: nil
71
71
  ```
@@ -10,7 +10,13 @@ module Guard
10
10
  module Runner
11
11
  class << self
12
12
 
13
- PHPUNIT_ERRORS_EXITCODE = 2
13
+ # The exittcode phpunit returns when the tests contain failures
14
+ #
15
+ PHPUNIT_FAILURES_EXITCODE = 1
16
+
17
+ # The exittcode phpunit returns when the tests contain errors
18
+ #
19
+ PHPUNIT_ERRORS_EXITCODE = 2
14
20
 
15
21
  # Runs the PHPUnit tests and displays notifications
16
22
  # about the results.
@@ -31,7 +37,7 @@ module Guard
31
37
  # return false in case the system call fails with no status!
32
38
  return false if $?.nil?
33
39
 
34
- if $?.success? or tests_contain_errors?
40
+ if $?.success? or tests_contain_failures? or tests_contain_errors?
35
41
  notify_results(output, options)
36
42
  else
37
43
  notify_failure(options)
@@ -97,6 +103,15 @@ module Guard
97
103
  return if options[:notification] == false
98
104
  ::Guard::Notifier.notify('Failed! Check the console', :title => 'PHPUnit results', :image => :failed)
99
105
  end
106
+
107
+ # Checks the exitstatus of the phpunit command
108
+ # for a sign of failures in the tests.
109
+ #
110
+ # @return [Boolean] whether the tests contain failures or not
111
+ #
112
+ def tests_contain_failures?
113
+ $?.exitstatus == PHPUNIT_FAILURES_EXITCODE
114
+ end
100
115
 
101
116
  # Checks the exitstatus of the phpunit command
102
117
  # for a sign of errors in the tests.
@@ -1,6 +1,6 @@
1
1
  module Guard
2
2
  # Guard::PHPUnitVersion is used in the gem specification.
3
3
  module PHPUnitVersion
4
- VERSION = "0.0.1"
4
+ VERSION = '0.0.2'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-phpunit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-24 00:00:00.000000000 Z
12
+ date: 2011-11-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard
16
- requirement: &13084420 !ruby/object:Gem::Requirement
16
+ requirement: &15297700 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.8.8
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *13084420
24
+ version_requirements: *15297700
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &13083340 !ruby/object:Gem::Requirement
27
+ requirement: &15297060 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '1.0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *13083340
35
+ version_requirements: *15297060
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &13082360 !ruby/object:Gem::Requirement
38
+ requirement: &15296540 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '2.7'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *13082360
46
+ version_requirements: *15296540
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: guard-rspec
49
- requirement: &13081360 !ruby/object:Gem::Requirement
49
+ requirement: &15295380 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0.5'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *13081360
57
+ version_requirements: *15295380
58
58
  description: Guard::PHPUnit automatically run your unit-tests written with the PHPUnit
59
59
  testing framework.
60
60
  email: