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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a16be8b1d2ec405ff1fe94fa9fbcb4ef35be484
4
- data.tar.gz: 26e55626cffb430aacb78b4a23306f865bef9a1e
3
+ metadata.gz: 23ebbfeb770bcb05bbe01d1ebcb1d3fad5aeb4ee
4
+ data.tar.gz: 6c45a2dd92051ed9265abb95db01ff2ab2dea3bf
5
5
  SHA512:
6
- metadata.gz: ddb199b714863f6ad04ceeb5a679bced3b3c0084c3e76c6dd301f14c4d39dac956da90b11a57cc9510c05eff581b9af1ea0f69dfb9b606e2b0bdfba273d49b5d
7
- data.tar.gz: 1141a9f175c2e1f3914a823c474da864432bcffa46363897686ee35d95d597387f25e9a55a82e60e495c5ea448e8f6f82a8f1643da5eca89b8aaf3097737c076
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 documentaion][4] uses the [Object Freezer][5] library as an example on how
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
@@ -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 < Guard
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(watchers = [], options = {})
38
+ def initialize(options = {})
40
39
  defaults = DEFAULT_OPTIONS.clone
41
40
  @options = defaults.merge(options)
42
- super(watchers, @options)
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:', text),
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:', 'Incomplete:'], text),
21
+ :pending => look_for_words_in(['(?:Skipped:|skipped)', 'Incomplete:'], text),
22
22
  :duration => look_for_duration_in(text)
23
23
  }
24
24
  results.freeze
@@ -13,7 +13,7 @@ module Guard
13
13
  # @param [Hash] options the notifier options
14
14
  #
15
15
  def notify(message, options)
16
- ::Guard::Notifier.notify(message, options)
16
+ Compat::UI.notify(message, options)
17
17
  end
18
18
 
19
19
  # Displays a notification about the tests results.
@@ -40,6 +40,7 @@ module Guard
40
40
  end
41
41
 
42
42
  def execute_phpunit(tests_folder, options)
43
+ require 'tempfile'
43
44
  log_file = Tempfile.new "guard-phpunit2"
44
45
  execute_command(phpunit_command(tests_folder, options, log_file.path))
45
46
 
@@ -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.
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module PHPUnit2Version
3
- VERSION = '0.2.8'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
@@ -1,8 +1,9 @@
1
1
  require 'spec_helper'
2
+ require 'guard/phpunit2/notifier'
2
3
 
3
4
  describe Guard::PHPUnit2::Notifier do
4
5
 
5
- let(:guard_notifier) { Guard::Notifier }
6
+ let(:guard_notifier) { Guard::Compat::UI }
6
7
 
7
8
  describe '.notify' do
8
9
  it 'calls the guard notifier' do
@@ -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 be_false
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 be_false
23
+ subject.run([]).should be false
24
24
  end
25
25
  end
26
26
 
@@ -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 be_true
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 be_true
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 be_true
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 be_true
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 be_false
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(nil, { :all_on_start => false,
39
- :all_after_pass => false,
40
- :keep_failed => false,
41
- :cli => '--colors',
42
- :tests_path => 'tests',
43
- :realtime => true}) }
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 be_false
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 be_false
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 be_false
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 be_true
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(nil, :all_on_start => false) }
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(nil, {:realtime => true }) }
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(nil, {:realtime => false }) }
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).and_return { |paths| paths }
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
- subject { Guard::PHPUnit2.new(nil, :keep_failed => false) }
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
- subject { Guard::PHPUnit2.new(nil, :all_after_pass => false) }
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)
@@ -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.color_enabled = true
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.2.8
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: '1.1'
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: '1.1'
45
+ version: '2.0'
32
46
  - - "<"
33
47
  - !ruby/object:Gem::Version
34
48
  version: '3.0'