guard-test 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,4 +1,20 @@
1
- ## 0.3.0.rc5 - June 9, 2011 - ([@rymai][])
1
+ ## 0.3.1 - September 11, 2011
2
+
3
+ ### New features:
4
+
5
+ - Pull request [#13](https://github.com/guard/guard-test/pull/13): New `test_paths` option to look for test files under other paths than `test`. ([@Ask11][])
6
+
7
+ ### Improvements:
8
+
9
+ - Pull request [#15](https://github.com/guard/guard-test/pull/15): Simplify some checks. ([@dasch][])
10
+
11
+ ## 0.3.0 - June 14, 2011
12
+
13
+ ### Improvements:
14
+
15
+ - Internal cleaning. ([@rymai][])
16
+
17
+ ## 0.3.0.rc5 - June 9, 2011
2
18
 
3
19
  ### Bugs fixes:
4
20
 
@@ -63,6 +79,8 @@
63
79
 
64
80
  - Pull request [#1](https://github.com/guard/guard-test/pull/1): Include errors count to determine the "flag" to display in notification. ([@gregorymostizky][])
65
81
 
82
+ [@Ask11]: https://github.com/Ask11
83
+ [@dasch]: https://github.com/dasch
66
84
  [@gregorymostizky]: https://github.com/gregorymostizky
67
85
  [@jgrau]: https://github.com/jgrau
68
86
  [@rymai]: https://github.com/rymai
data/README.md CHANGED
@@ -6,14 +6,14 @@ If you have any questions about Guard or Guard::Test, please join us on our [Goo
6
6
 
7
7
  ## Features
8
8
 
9
- - Compatible with Test::Unit >= 2.2 and Minitest (Ruby 1.9).
9
+ - Compatible with Test::Unit >= 2.2.
10
10
  - Tested on Ruby 1.8.7, 1.9.2, REE, Rubinius and JRuby.
11
11
 
12
12
  ## Install
13
13
 
14
14
  Please be sure to have [Guard](https://github.com/guard/guard) installed before continue.
15
15
 
16
- If you're using Bundler, add it to your `Gemfile` (inside the `test` group):
16
+ If you're using Bundler, add it to your `Gemfile` (inside the `development` group):
17
17
 
18
18
  ```ruby
19
19
  gem 'guard-test'
@@ -79,6 +79,14 @@ Guard::Test allows you to choose between two different runners (Guard::Test's ru
79
79
  and print failures/errors messages & backtraces when all the tests are finished. Obviously, this is the guard-test default.
80
80
  - `fastfail`: Display tests results as they happen and print failures/errors messages & backtraces immediately.
81
81
 
82
+ By default, guard-test will only look for test files within `test/` in your project root. You can add any paths using the `:test_paths` option:
83
+
84
+ ```ruby
85
+ guard 'test', :test_paths => ['test', 'vendor/plugins/recaptcha/test', 'any/path/test'] do
86
+ # ...
87
+ end
88
+ ```
89
+
82
90
  Available options:
83
91
 
84
92
  ```ruby
@@ -89,6 +97,7 @@ Available options:
89
97
  :all_on_start => false # don't run all the tests at startup, default: true
90
98
  :all_after_pass => false # don't run all tests after changed tests pass, default: true
91
99
  :keep_failed => false # keep failed tests until them pass, default: true
100
+ :test_paths => ['spec'] # specify an array of paths that contain test files
92
101
  ```
93
102
 
94
103
  ## Development
@@ -96,7 +105,13 @@ Available options:
96
105
  - Source hosted on GitHub: https://github.com/guard/guard-test
97
106
  - Report issues and feature requests to GitHub Issues: https://github.com/guard/guard-test/issues
98
107
 
99
- Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change you make. Please do not change the version in your pull-request.
108
+ Pull requests are very welcome! Please try to follow these simple "rules", though:
109
+
110
+ - Please create a topic branch for every separate change you make;
111
+ - Make sure your patches are well tested;
112
+ - Update the README (if applicable);
113
+ - Update the CHANGELOG (maybe not for a typo but don't hesitate!);
114
+ - Please do not change the version number.
100
115
 
101
116
  For questions please join us on our [Google group](http://groups.google.com/group/guard-dev) or on `#guard` (irc.freenode.net).
102
117
 
@@ -4,6 +4,14 @@ module Guard
4
4
  module Inspector
5
5
 
6
6
  class << self
7
+ def test_paths
8
+ @test_paths || []
9
+ end
10
+
11
+ def test_paths=(path_array)
12
+ @test_paths = Array(path_array)
13
+ end
14
+
7
15
  def clean(paths)
8
16
  paths.uniq!
9
17
  paths.compact!
@@ -11,7 +19,7 @@ module Guard
11
19
  paths.dup.each do |path|
12
20
  if test_folder?(path)
13
21
  paths.delete(path)
14
- paths += Dir.glob("#{path}/**/test_*.rb") + Dir.glob("#{path}/**/*_test.rb")
22
+ paths += check_test_files(path)
15
23
  else
16
24
  paths.delete(path) unless test_file?(path)
17
25
  end
@@ -26,7 +34,8 @@ module Guard
26
34
  private
27
35
 
28
36
  def test_folder?(path)
29
- path.match(/^\/?test/) && !path.match(/\..+$/) && File.directory?(path)
37
+ paths = test_paths.join("|")
38
+ path.match(%r{^\/?(#{paths})}) && !path.match(/\..+$/) && File.directory?(path)
30
39
  end
31
40
 
32
41
  def test_file?(path)
@@ -34,12 +43,16 @@ module Guard
34
43
  end
35
44
 
36
45
  def test_files
37
- @test_files ||= Dir.glob('test/**/test_*.rb') + Dir.glob('test/**/*_test.rb')
46
+ @test_files ||= test_paths.collect { |path| check_test_files(path) }.flatten
38
47
  end
39
48
 
40
49
  def clear_test_files_list
41
50
  @test_files = nil
42
51
  end
52
+
53
+ def check_test_files(path)
54
+ Dir[File.join(path, '**', 'test_*.rb')] + Dir[File.join(path, '**', '*_test.rb')]
55
+ end
43
56
  end
44
57
 
45
58
  end
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+ require 'guard'
2
3
  require 'guard/notifier'
3
4
  require 'guard/test/result_helpers'
4
5
 
@@ -25,21 +25,15 @@ module Guard
25
25
  end
26
26
 
27
27
  def rvm?
28
- if @rvm.nil?
29
- @rvm = @options[:rvm] && @options[:rvm].respond_to?(:join)
30
- end
31
- @rvm
28
+ @rvm ||= @options[:rvm] && @options[:rvm].respond_to?(:join)
32
29
  end
33
30
 
34
31
  def turn?
35
- if @turn.nil?
36
- @turn = begin
37
- require 'turn'
38
- rescue LoadError => ex
39
- false
40
- end
32
+ @turn ||= begin
33
+ require 'turn'
34
+ rescue LoadError
35
+ false
41
36
  end
42
- @turn
43
37
  end
44
38
 
45
39
  private
@@ -50,7 +44,7 @@ module Guard
50
44
  cmd_parts << "bundle exec" if @options[:bundler] && !turn?
51
45
  cmd_parts << "#{turn? ? 'turn' : 'ruby'} -Itest"
52
46
  cmd_parts << "-r bundler/setup" if @options[:bundler] && !turn?
53
-
47
+
54
48
  unless turn?
55
49
  cmd_parts << "-r #{File.expand_path("../runners/#{@runner_name}_guard_test_runner", __FILE__)}"
56
50
  cmd_parts << "-e \"%w[#{paths.join(' ')}].each { |p| load p }\""
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  module Guard
3
3
  module TestVersion
4
- VERSION = "0.3.0" unless defined? TestVersion::VERSION
4
+ VERSION = "0.3.1" unless defined? TestVersion::VERSION
5
5
  end
6
6
  end
data/lib/guard/test.rb CHANGED
@@ -15,7 +15,8 @@ module Guard
15
15
  @options = {
16
16
  :all_on_start => true,
17
17
  :all_after_pass => true,
18
- :keep_failed => true
18
+ :keep_failed => true,
19
+ :test_paths => ['test']
19
20
  }.update(options)
20
21
  @last_failed = false
21
22
  @failed_paths = []
@@ -29,7 +30,9 @@ module Guard
29
30
  end
30
31
 
31
32
  def run_all
32
- passed = @runner.run(Inspector.clean(['test']), :message => 'Running all tests')
33
+ Inspector.test_paths = @options[:test_paths]
34
+ test_paths = @options[:test_paths].clone # because clean - cleaning variable
35
+ passed = @runner.run(Inspector.clean(test_paths), :message => 'Running all tests')
33
36
 
34
37
  @failed_paths = [] if passed
35
38
  @last_failed = !passed
@@ -40,6 +43,7 @@ module Guard
40
43
  end
41
44
 
42
45
  def run_on_change(paths)
46
+ Inspector.test_paths = @options[:test_paths]
43
47
  paths += @failed_paths if @options[:keep_failed]
44
48
  paths = Inspector.clean(paths)
45
49
  passed = @runner.run(paths)
metadata CHANGED
@@ -1,73 +1,67 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: guard-test
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.1
4
5
  prerelease:
5
- version: 0.3.0
6
6
  platform: ruby
7
- authors:
8
- - "R\xC3\xA9my Coutable"
7
+ authors:
8
+ - Rémy Coutable
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-06-14 00:00:00 +02:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2011-09-11 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: guard
18
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &2157114800 !ruby/object:Gem::Requirement
19
17
  none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 0.2.2
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.4.0
24
22
  type: :runtime
25
23
  prerelease: false
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
24
+ version_requirements: *2157114800
25
+ - !ruby/object:Gem::Dependency
28
26
  name: test-unit
29
- requirement: &id002 !ruby/object:Gem::Requirement
27
+ requirement: &2157113380 !ruby/object:Gem::Requirement
30
28
  none: false
31
- requirements:
29
+ requirements:
32
30
  - - ~>
33
- - !ruby/object:Gem::Version
34
- version: "2.2"
31
+ - !ruby/object:Gem::Version
32
+ version: 2.3.1
35
33
  type: :runtime
36
34
  prerelease: false
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
35
+ version_requirements: *2157113380
36
+ - !ruby/object:Gem::Dependency
39
37
  name: bundler
40
- requirement: &id003 !ruby/object:Gem::Requirement
38
+ requirement: &2157112120 !ruby/object:Gem::Requirement
41
39
  none: false
42
- requirements:
40
+ requirements:
43
41
  - - ~>
44
- - !ruby/object:Gem::Version
45
- version: "1.0"
42
+ - !ruby/object:Gem::Version
43
+ version: '1.0'
46
44
  type: :development
47
45
  prerelease: false
48
- version_requirements: *id003
49
- - !ruby/object:Gem::Dependency
46
+ version_requirements: *2157112120
47
+ - !ruby/object:Gem::Dependency
50
48
  name: rspec
51
- requirement: &id004 !ruby/object:Gem::Requirement
49
+ requirement: &2157111180 !ruby/object:Gem::Requirement
52
50
  none: false
53
- requirements:
51
+ requirements:
54
52
  - - ~>
55
- - !ruby/object:Gem::Version
56
- version: "2.5"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.6'
57
55
  type: :development
58
56
  prerelease: false
59
- version_requirements: *id004
57
+ version_requirements: *2157111180
60
58
  description: Guard::Test automatically run your tests on file modification.
61
- email:
59
+ email:
62
60
  - rymai@rymai.me
63
61
  executables: []
64
-
65
62
  extensions: []
66
-
67
63
  extra_rdoc_files: []
68
-
69
- files:
70
- - lib/guard/test/formatter.rbc
64
+ files:
71
65
  - lib/guard/test/inspector.rb
72
66
  - lib/guard/test/inspector.rbc
73
67
  - lib/guard/test/notifier.rb
@@ -92,36 +86,28 @@ files:
92
86
  - CHANGELOG.md
93
87
  - LICENSE
94
88
  - README.md
95
- has_rdoc: true
96
89
  homepage: https://github.com/guard/guard-test
97
90
  licenses: []
98
-
99
91
  post_install_message:
100
92
  rdoc_options: []
101
-
102
- require_paths:
93
+ require_paths:
103
94
  - lib
104
- required_ruby_version: !ruby/object:Gem::Requirement
95
+ required_ruby_version: !ruby/object:Gem::Requirement
105
96
  none: false
106
- requirements:
107
- - - ">="
108
- - !ruby/object:Gem::Version
109
- hash: 907163475134337955
110
- segments:
111
- - 0
112
- version: "0"
113
- required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ! '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
102
  none: false
115
- requirements:
116
- - - ">="
117
- - !ruby/object:Gem::Version
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
118
106
  version: 1.3.6
119
107
  requirements: []
120
-
121
108
  rubyforge_project: guard-test
122
- rubygems_version: 1.6.2
109
+ rubygems_version: 1.8.10
123
110
  signing_key:
124
111
  specification_version: 3
125
- summary: Guard gem for Test::Unit
112
+ summary: Guard gem for test-unit 2
126
113
  test_files: []
127
-