guard-phpunit2 0.2.8 → 0.3.0
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 +4 -4
- data/README.md +1 -1
- data/lib/guard/phpunit2.rb +4 -5
- data/lib/guard/phpunit2/formatter.rb +2 -2
- data/lib/guard/phpunit2/notifier.rb +1 -1
- data/lib/guard/phpunit2/realtime_runner.rb +1 -0
- data/lib/guard/phpunit2/runner.rb +2 -2
- data/lib/guard/phpunit2/version.rb +1 -1
- data/spec/guard/phpunit2/notifier_spec.rb +2 -1
- data/spec/guard/phpunit2/realtime_runner_spec.rb +2 -2
- data/spec/guard/phpunit2/runner_spec.rb +2 -2
- data/spec/guard/phpunit2_spec.rb +21 -21
- data/spec/spec_helper.rb +4 -1
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23ebbfeb770bcb05bbe01d1ebcb1d3fad5aeb4ee
|
4
|
+
data.tar.gz: 6c45a2dd92051ed9265abb95db01ff2ab2dea3bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a562f8b60ad6ba3bd4759690b3bf005c3c29075f071d14c2183cd1a78d810e8f133929f5f6e6a8e6295c8ba5431ccdf6ee22e05c85f408a12bf2d31b973f7589
|
7
|
+
data.tar.gz: b436baa26822f98553c3670f94234366718cdb71ed1940180ede6546fac4e75db097908afaf82bbb0ac4a1d58a3a56ac5850d3497172f1227bdcb4f27d19faec
|
data/README.md
CHANGED
@@ -41,7 +41,7 @@ search for tests and run them on start (if you enabled the `:all_on_start` optio
|
|
41
41
|
|
42
42
|
### Example PHP project
|
43
43
|
|
44
|
-
The [PHPUnit
|
44
|
+
The [PHPUnit documentation][4] uses the [Object Freezer][5] library as an example on how
|
45
45
|
to organize tests. This project uses the `Tests` directory for its tests.
|
46
46
|
|
47
47
|
An example of the Guardfile for the same project would look
|
data/lib/guard/phpunit2.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
require 'guard'
|
2
|
-
require 'guard/guard'
|
1
|
+
require 'guard/compat/plugin'
|
3
2
|
require 'guard/phpunit2/version'
|
4
3
|
|
5
4
|
module Guard
|
@@ -7,7 +6,7 @@ module Guard
|
|
7
6
|
# The PHPUnit guard gets notified about system
|
8
7
|
# events.
|
9
8
|
#
|
10
|
-
class PHPUnit2 <
|
9
|
+
class PHPUnit2 < Plugin
|
11
10
|
|
12
11
|
autoload :Inspector, 'guard/phpunit2/inspector'
|
13
12
|
autoload :Formatter, 'guard/phpunit2/formatter'
|
@@ -36,10 +35,10 @@ module Guard
|
|
36
35
|
# @option options [String] :cli The CLI arguments passed to phpunit
|
37
36
|
# @option options [String] :tests_path the path where all tests exist
|
38
37
|
#
|
39
|
-
def initialize(
|
38
|
+
def initialize(options = {})
|
40
39
|
defaults = DEFAULT_OPTIONS.clone
|
41
40
|
@options = defaults.merge(options)
|
42
|
-
super(
|
41
|
+
super(@options)
|
43
42
|
|
44
43
|
@failed_paths = []
|
45
44
|
@previous_failed = false
|
@@ -16,9 +16,9 @@ module Guard
|
|
16
16
|
def parse_output(text)
|
17
17
|
results = {
|
18
18
|
:tests => look_for_words_in('(?:Tests:|tests)', text),
|
19
|
-
:failures => look_for_words_in('Failures
|
19
|
+
:failures => look_for_words_in('(?:Failures:|failures)', text),
|
20
20
|
:errors => look_for_words_in('Errors:', text),
|
21
|
-
:pending => look_for_words_in(['Skipped
|
21
|
+
:pending => look_for_words_in(['(?:Skipped:|skipped)', 'Incomplete:'], text),
|
22
22
|
:duration => look_for_duration_in(text)
|
23
23
|
}
|
24
24
|
results.freeze
|
@@ -34,7 +34,7 @@ module Guard
|
|
34
34
|
return false if paths.empty?
|
35
35
|
|
36
36
|
unless phpunit_exists?(options)
|
37
|
-
UI.error('the provided php unit command is invalid or phpunit is not installed on your machine.', :reset => true)
|
37
|
+
Compat::UI.error('the provided php unit command is invalid or phpunit is not installed on your machine.', :reset => true)
|
38
38
|
return false
|
39
39
|
end
|
40
40
|
|
@@ -100,7 +100,7 @@ module Guard
|
|
100
100
|
#
|
101
101
|
def notify_start(paths, options)
|
102
102
|
message = options[:message] || "Running: #{paths.join(' ')}"
|
103
|
-
UI.info(message, :reset => true)
|
103
|
+
Compat::UI.info(message, :reset => true)
|
104
104
|
end
|
105
105
|
|
106
106
|
# Displays a notification about the tests results.
|
@@ -5,7 +5,7 @@ describe Guard::PHPUnit2::RealtimeRunner do
|
|
5
5
|
let(:formatter) { Guard::PHPUnit2::Formatter }
|
6
6
|
let(:logreader) { Guard::PHPUnit2::LogReader }
|
7
7
|
let(:notifier) { Guard::PHPUnit2::Notifier }
|
8
|
-
let(:ui) { Guard::UI
|
8
|
+
let(:ui) { Guard::Compat::UI }
|
9
9
|
|
10
10
|
describe '#run' do
|
11
11
|
before do
|
@@ -21,7 +21,7 @@ describe Guard::PHPUnit2::RealtimeRunner do
|
|
21
21
|
|
22
22
|
context 'when passed an empty paths list' do
|
23
23
|
it 'returns false' do
|
24
|
-
subject.run([]).should
|
24
|
+
subject.run([]).should be false
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -4,7 +4,7 @@ describe Guard::PHPUnit2::Runner do
|
|
4
4
|
|
5
5
|
let(:formatter) { Guard::PHPUnit2::Formatter }
|
6
6
|
let(:notifier) { Guard::PHPUnit2::Notifier }
|
7
|
-
let(:ui) { Guard::UI
|
7
|
+
let(:ui) { Guard::Compat::UI }
|
8
8
|
|
9
9
|
describe '#run' do
|
10
10
|
before do
|
@@ -20,7 +20,7 @@ describe Guard::PHPUnit2::Runner do
|
|
20
20
|
|
21
21
|
context 'when passed an empty paths list' do
|
22
22
|
it 'returns false' do
|
23
|
-
subject.run([]).should
|
23
|
+
subject.run([]).should be false
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
data/spec/guard/phpunit2_spec.rb
CHANGED
@@ -9,15 +9,15 @@ describe Guard::PHPUnit2 do
|
|
9
9
|
describe '#initialize' do
|
10
10
|
context 'when no options are provided' do
|
11
11
|
it 'sets a default :all_on_start option' do
|
12
|
-
subject.options[:all_on_start].should
|
12
|
+
subject.options[:all_on_start].should be true
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'sets a default :all_after_pass option' do
|
16
|
-
subject.options[:all_after_pass].should
|
16
|
+
subject.options[:all_after_pass].should be true
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'sets a default :keep_failed option' do
|
20
|
-
subject.options[:keep_failed].should
|
20
|
+
subject.options[:keep_failed].should be true
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'sets a default :tests_path option' do
|
@@ -25,33 +25,33 @@ describe Guard::PHPUnit2 do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'sets a default :notification option' do
|
28
|
-
subject.options[:notification].should
|
28
|
+
subject.options[:notification].should be true
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'sets a default :realtime option' do
|
32
|
-
subject.options[:realtime].should
|
32
|
+
subject.options[:realtime].should be false
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
context 'when other options are provided' do
|
37
37
|
|
38
|
-
subject { Guard::PHPUnit2.new(
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
38
|
+
subject { Guard::PHPUnit2.new({ :all_on_start => false,
|
39
|
+
:all_after_pass => false,
|
40
|
+
:keep_failed => false,
|
41
|
+
:cli => '--colors',
|
42
|
+
:tests_path => 'tests',
|
43
|
+
:realtime => true}) }
|
44
44
|
|
45
45
|
it 'sets :all_on_start with the provided option' do
|
46
|
-
subject.options[:all_on_start].should
|
46
|
+
subject.options[:all_on_start].should be false
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'sets :all_after_pass with the provided option' do
|
50
|
-
subject.options[:all_after_pass].should
|
50
|
+
subject.options[:all_after_pass].should be false
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'sets :keep_failed with the provided option' do
|
54
|
-
subject.options[:keep_failed].should
|
54
|
+
subject.options[:keep_failed].should be false
|
55
55
|
end
|
56
56
|
|
57
57
|
it 'sets :cli with the provided option' do
|
@@ -63,7 +63,7 @@ describe Guard::PHPUnit2 do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
it 'sets :realtime with the provided option' do
|
66
|
-
subject.options[:realtime].should
|
66
|
+
subject.options[:realtime].should be true
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
@@ -82,7 +82,7 @@ describe Guard::PHPUnit2 do
|
|
82
82
|
end
|
83
83
|
|
84
84
|
context 'with the :all_on_start option set to false' do
|
85
|
-
subject { Guard::PHPUnit2.new(
|
85
|
+
subject { Guard::PHPUnit2.new(:all_on_start => false) }
|
86
86
|
|
87
87
|
it 'calls #run_all' do
|
88
88
|
subject.should_not_receive(:run_all)
|
@@ -110,7 +110,7 @@ describe Guard::PHPUnit2 do
|
|
110
110
|
|
111
111
|
describe 'realtime handling' do
|
112
112
|
describe 'realtime endabled' do
|
113
|
-
let(:guard) { Guard::PHPUnit2.new(
|
113
|
+
let(:guard) { Guard::PHPUnit2.new({:realtime => true }) }
|
114
114
|
it 'should call run on the realtimerunner' do
|
115
115
|
Guard::PHPUnit2::RealtimeRunner.should_receive(:run).and_return(true)
|
116
116
|
guard.run_on_changes ['tests/firstTest.php']
|
@@ -118,7 +118,7 @@ describe Guard::PHPUnit2 do
|
|
118
118
|
end
|
119
119
|
|
120
120
|
describe 'realtime disabled' do
|
121
|
-
let(:guard) { Guard::PHPUnit2.new(
|
121
|
+
let(:guard) { Guard::PHPUnit2.new({:realtime => false }) }
|
122
122
|
|
123
123
|
it 'should call run on the Runner class' do
|
124
124
|
Guard::PHPUnit2::Runner.should_receive(:run).and_return(true)
|
@@ -129,7 +129,7 @@ describe Guard::PHPUnit2 do
|
|
129
129
|
|
130
130
|
describe '#run_on_changes' do
|
131
131
|
before do
|
132
|
-
inspector.stub(:clean)
|
132
|
+
inspector.stub(:clean) { |paths| paths }
|
133
133
|
end
|
134
134
|
|
135
135
|
it 'cleans the changed paths before running the tests' do
|
@@ -171,7 +171,7 @@ describe Guard::PHPUnit2 do
|
|
171
171
|
end
|
172
172
|
|
173
173
|
context 'with the :keep_failed option set to false' do
|
174
|
-
|
174
|
+
subject { Guard::PHPUnit2.new(:keep_failed => false) }
|
175
175
|
|
176
176
|
it 'runs the next changed files normally without the failed tests' do
|
177
177
|
expect { subject.run_on_changes ['tests/firstTest.php'] }.to throw_symbol :task_has_failed
|
@@ -204,7 +204,7 @@ describe Guard::PHPUnit2 do
|
|
204
204
|
end
|
205
205
|
|
206
206
|
context 'with the :all_after_pass option set to false' do
|
207
|
-
|
207
|
+
subject { Guard::PHPUnit2.new(:all_after_pass => false) }
|
208
208
|
|
209
209
|
it 'does not call #run_all' do
|
210
210
|
subject.should_not_receive(:run_all)
|
data/spec/spec_helper.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
require 'rspec'
|
2
|
+
require 'guard/notifier'
|
3
|
+
require 'guard/compat/test/helper'
|
2
4
|
require 'guard/phpunit2'
|
3
5
|
|
4
6
|
RSpec.configure do |config|
|
5
7
|
|
6
8
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
7
9
|
config.run_all_when_everything_filtered = true
|
8
|
-
config.
|
10
|
+
config.color = true
|
11
|
+
config.raise_errors_for_deprecations!
|
9
12
|
config.filter_run :focus
|
10
13
|
|
11
14
|
config.before(:each) do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-phpunit2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maher Sallam
|
@@ -12,13 +12,27 @@ bindir: bin
|
|
12
12
|
cert_chain: []
|
13
13
|
date: 2015-04-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: guard-compat
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.2'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '1.2'
|
15
29
|
- !ruby/object:Gem::Dependency
|
16
30
|
name: guard
|
17
31
|
requirement: !ruby/object:Gem::Requirement
|
18
32
|
requirements:
|
19
|
-
- - "
|
33
|
+
- - "~>"
|
20
34
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
35
|
+
version: '2.0'
|
22
36
|
- - "<"
|
23
37
|
- !ruby/object:Gem::Version
|
24
38
|
version: '3.0'
|
@@ -26,9 +40,9 @@ dependencies:
|
|
26
40
|
prerelease: false
|
27
41
|
version_requirements: !ruby/object:Gem::Requirement
|
28
42
|
requirements:
|
29
|
-
- - "
|
43
|
+
- - "~>"
|
30
44
|
- !ruby/object:Gem::Version
|
31
|
-
version: '
|
45
|
+
version: '2.0'
|
32
46
|
- - "<"
|
33
47
|
- !ruby/object:Gem::Version
|
34
48
|
version: '3.0'
|