guard-test 0.2.0 → 0.3.0.rc2
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/LICENSE +1 -1
- data/README.md +128 -0
- data/lib/guard/test.rb +47 -9
- data/lib/guard/test.rbc +761 -157
- data/lib/guard/test/formatter.rbc +215 -91
- data/lib/guard/test/inspector.rb +13 -12
- data/lib/guard/test/inspector.rbc +126 -77
- data/lib/guard/test/notifier.rb +17 -0
- data/lib/guard/test/notifier.rbc +435 -0
- data/lib/guard/test/result_helpers.rb +28 -0
- data/lib/guard/test/result_helpers.rbc +798 -0
- data/lib/guard/test/runner.rb +46 -30
- data/lib/guard/test/runner.rbc +812 -494
- data/lib/guard/test/runners/{default_test_unit_runner.rb → default_guard_test_runner.rb} +19 -15
- data/lib/guard/test/runners/default_guard_test_runner.rbc +1471 -0
- data/lib/guard/test/runners/default_test_unit_runner.rbc +2 -2
- data/lib/guard/test/runners/{fastfail_test_unit_runner.rb → fastfail_guard_test_runner.rb} +11 -7
- data/lib/guard/test/runners/fastfail_guard_test_runner.rbc +614 -0
- data/lib/guard/test/runners/fastfail_test_unit_runner.rbc +1 -1
- data/lib/guard/test/templates/Guardfile +6 -6
- data/lib/guard/test/ui.rb +38 -0
- data/lib/guard/test/ui.rbc +1053 -0
- data/lib/guard/test/version.rb +2 -1
- data/lib/guard/test/version.rbc +6 -6
- metadata +49 -21
- data/README.rdoc +0 -89
- data/lib/guard/test/formatter.rb +0 -68
data/lib/guard/test/version.rb
CHANGED
data/lib/guard/test/version.rbc
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
!RBIX
|
2
|
-
|
2
|
+
17831730954501249321
|
3
3
|
x
|
4
4
|
M
|
5
5
|
1
|
@@ -151,8 +151,8 @@ x
|
|
151
151
|
7
|
152
152
|
VERSION
|
153
153
|
s
|
154
|
-
|
155
|
-
0.
|
154
|
+
9
|
155
|
+
0.3.0.rc1
|
156
156
|
x
|
157
157
|
9
|
158
158
|
const_set
|
@@ -161,7 +161,7 @@ p
|
|
161
161
|
I
|
162
162
|
2
|
163
163
|
I
|
164
|
-
|
164
|
+
4
|
165
165
|
I
|
166
166
|
c
|
167
167
|
x
|
@@ -177,7 +177,7 @@ p
|
|
177
177
|
I
|
178
178
|
2
|
179
179
|
I
|
180
|
-
|
180
|
+
3
|
181
181
|
I
|
182
182
|
1c
|
183
183
|
x
|
@@ -193,7 +193,7 @@ p
|
|
193
193
|
I
|
194
194
|
0
|
195
195
|
I
|
196
|
-
|
196
|
+
2
|
197
197
|
I
|
198
198
|
1c
|
199
199
|
x
|
metadata
CHANGED
@@ -1,8 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
4
|
+
hash: 15424033
|
5
|
+
prerelease: 6
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
- rc
|
11
|
+
- 2
|
12
|
+
version: 0.3.0.rc2
|
6
13
|
platform: ruby
|
7
14
|
authors:
|
8
15
|
- "R\xC3\xA9my Coutable"
|
@@ -10,7 +17,7 @@ autorequire:
|
|
10
17
|
bindir: bin
|
11
18
|
cert_chain: []
|
12
19
|
|
13
|
-
date: 2011-
|
20
|
+
date: 2011-06-02 00:00:00 Z
|
14
21
|
dependencies:
|
15
22
|
- !ruby/object:Gem::Dependency
|
16
23
|
name: guard
|
@@ -20,6 +27,11 @@ dependencies:
|
|
20
27
|
requirements:
|
21
28
|
- - ">="
|
22
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 19
|
31
|
+
segments:
|
32
|
+
- 0
|
33
|
+
- 2
|
34
|
+
- 2
|
23
35
|
version: 0.2.2
|
24
36
|
type: :runtime
|
25
37
|
version_requirements: *id001
|
@@ -29,8 +41,12 @@ dependencies:
|
|
29
41
|
requirement: &id002 !ruby/object:Gem::Requirement
|
30
42
|
none: false
|
31
43
|
requirements:
|
32
|
-
- -
|
44
|
+
- - ">="
|
33
45
|
- !ruby/object:Gem::Version
|
46
|
+
hash: 7
|
47
|
+
segments:
|
48
|
+
- 2
|
49
|
+
- 2
|
34
50
|
version: "2.2"
|
35
51
|
type: :runtime
|
36
52
|
version_requirements: *id002
|
@@ -42,6 +58,10 @@ dependencies:
|
|
42
58
|
requirements:
|
43
59
|
- - ~>
|
44
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 15
|
62
|
+
segments:
|
63
|
+
- 1
|
64
|
+
- 0
|
45
65
|
version: "1.0"
|
46
66
|
type: :development
|
47
67
|
version_requirements: *id003
|
@@ -53,20 +73,13 @@ dependencies:
|
|
53
73
|
requirements:
|
54
74
|
- - ~>
|
55
75
|
- !ruby/object:Gem::Version
|
76
|
+
hash: 9
|
77
|
+
segments:
|
78
|
+
- 2
|
79
|
+
- 5
|
56
80
|
version: "2.5"
|
57
81
|
type: :development
|
58
82
|
version_requirements: *id004
|
59
|
-
- !ruby/object:Gem::Dependency
|
60
|
-
name: guard-rspec
|
61
|
-
prerelease: false
|
62
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
63
|
-
none: false
|
64
|
-
requirements:
|
65
|
-
- - ~>
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: "0.2"
|
68
|
-
type: :development
|
69
|
-
version_requirements: *id005
|
70
83
|
description: Guard::Test automatically run your tests (much like autotest).
|
71
84
|
email:
|
72
85
|
- rymai@rymai.me
|
@@ -77,23 +90,30 @@ extensions: []
|
|
77
90
|
extra_rdoc_files: []
|
78
91
|
|
79
92
|
files:
|
80
|
-
- lib/guard/test/formatter.rb
|
81
93
|
- lib/guard/test/formatter.rbc
|
82
94
|
- lib/guard/test/inspector.rb
|
83
95
|
- lib/guard/test/inspector.rbc
|
96
|
+
- lib/guard/test/notifier.rb
|
97
|
+
- lib/guard/test/notifier.rbc
|
98
|
+
- lib/guard/test/result_helpers.rb
|
99
|
+
- lib/guard/test/result_helpers.rbc
|
84
100
|
- lib/guard/test/runner.rb
|
85
101
|
- lib/guard/test/runner.rbc
|
86
|
-
- lib/guard/test/runners/
|
102
|
+
- lib/guard/test/runners/default_guard_test_runner.rb
|
103
|
+
- lib/guard/test/runners/default_guard_test_runner.rbc
|
87
104
|
- lib/guard/test/runners/default_test_unit_runner.rbc
|
88
|
-
- lib/guard/test/runners/
|
105
|
+
- lib/guard/test/runners/fastfail_guard_test_runner.rb
|
106
|
+
- lib/guard/test/runners/fastfail_guard_test_runner.rbc
|
89
107
|
- lib/guard/test/runners/fastfail_test_unit_runner.rbc
|
90
108
|
- lib/guard/test/templates/Guardfile
|
109
|
+
- lib/guard/test/ui.rb
|
110
|
+
- lib/guard/test/ui.rbc
|
91
111
|
- lib/guard/test/version.rb
|
92
112
|
- lib/guard/test/version.rbc
|
93
113
|
- lib/guard/test.rb
|
94
114
|
- lib/guard/test.rbc
|
95
115
|
- LICENSE
|
96
|
-
- README.
|
116
|
+
- README.md
|
97
117
|
homepage: http://rubygems.org/gems/guard-test
|
98
118
|
licenses: []
|
99
119
|
|
@@ -107,17 +127,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
127
|
requirements:
|
108
128
|
- - ">="
|
109
129
|
- !ruby/object:Gem::Version
|
110
|
-
|
130
|
+
hash: 3
|
131
|
+
segments:
|
132
|
+
- 0
|
133
|
+
version: "0"
|
111
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
135
|
none: false
|
113
136
|
requirements:
|
114
137
|
- - ">="
|
115
138
|
- !ruby/object:Gem::Version
|
139
|
+
hash: 23
|
140
|
+
segments:
|
141
|
+
- 1
|
142
|
+
- 3
|
143
|
+
- 6
|
116
144
|
version: 1.3.6
|
117
145
|
requirements: []
|
118
146
|
|
119
147
|
rubyforge_project: guard-test
|
120
|
-
rubygems_version: 1.
|
148
|
+
rubygems_version: 1.8.5
|
121
149
|
signing_key:
|
122
150
|
specification_version: 3
|
123
151
|
summary: Guard gem for Test::Unit
|
data/README.rdoc
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
= Guard::Test
|
2
|
-
|
3
|
-
Test::Unit guard allows to automatically & intelligently launch tests when files are modified or created.
|
4
|
-
|
5
|
-
== Compatibility
|
6
|
-
|
7
|
-
- Compatible with Test::Unit 2.2.0.
|
8
|
-
- Tested on Ruby 1.8.7, REE, 1.9.2, JRuby and Rubinius.
|
9
|
-
|
10
|
-
== Install
|
11
|
-
|
12
|
-
Please be sure to have {Guard}[https://github.com/guard/guard] installed before continue.
|
13
|
-
|
14
|
-
Install the gem:
|
15
|
-
|
16
|
-
gem install guard-test
|
17
|
-
|
18
|
-
Add it to your Gemfile (inside test group):
|
19
|
-
|
20
|
-
gem 'guard-test'
|
21
|
-
|
22
|
-
Add Guard definition to your Guardfile by running this command:
|
23
|
-
|
24
|
-
guard init test
|
25
|
-
|
26
|
-
== Usage
|
27
|
-
|
28
|
-
Please read {Guard usage doc}[https://github.com/guard/guard#readme].
|
29
|
-
|
30
|
-
== Guardfile
|
31
|
-
|
32
|
-
Guard::Test can be adapted to many kind of projects.
|
33
|
-
|
34
|
-
=== Standard Ruby project
|
35
|
-
|
36
|
-
guard 'test' do
|
37
|
-
watch(%r{lib/(.*)\.rb}) { |m| "test/#{m[1]}_test.rb" }
|
38
|
-
watch(%r{test/.*_test\.rb})
|
39
|
-
watch('test/test_helper.rb') { "test" }
|
40
|
-
end
|
41
|
-
|
42
|
-
=== Ruby On Rails project
|
43
|
-
|
44
|
-
guard 'test' do
|
45
|
-
watch(%r{app/models/(.*)\.rb}) { |m| "test/unit/#{m[1]}_test.rb" }
|
46
|
-
watch(%r{app/controllers/(.*)\.rb}) { |m| "test/functional/#{m[1]}_test.rb" }
|
47
|
-
watch(%r{app/views/.*\.rb}) { "test/integration" }
|
48
|
-
watch(%r{lib/(.*)\.rb}) { |m| "test/#{m[1]}_test.rb" }
|
49
|
-
watch(%r{test/.*_test.rb})
|
50
|
-
watch('app/controllers/application_controller.rb') { ["test/functional", "test/integration"] }
|
51
|
-
watch('test/test_helper.rb') { "test" }
|
52
|
-
end
|
53
|
-
|
54
|
-
Please read {Guard doc}[https://github.com/guard/guard#readme] for more info about Guardfile DSL.
|
55
|
-
|
56
|
-
== Options
|
57
|
-
|
58
|
-
Guard::Test allows you to choose between two different runners (Guard::Test's runners are inherited from Test::Unit's console runner):
|
59
|
-
- <tt>'default'</tt>: Display tests results as they happen, with different chars ('.' for pass, 'F' for fail, 'E' for error) and print failures/errors messages & backtraces when all the tests are finished. Obviously, this is the guard-test default.
|
60
|
-
- <tt>'fastfail'</tt>: Display tests results as they happen and print failures/errors messages & backtraces immediately.
|
61
|
-
|
62
|
-
Available options:
|
63
|
-
|
64
|
-
:runner => 'fastfail' # default to 'default'
|
65
|
-
:bundler => false # don't use "bundle exec"
|
66
|
-
:rvm => ['1.8.7', '1.9.2'] # directly run your specs on multiple ruby
|
67
|
-
|
68
|
-
Set the desired options as follow method:
|
69
|
-
|
70
|
-
guard 'test', :runner => 'fastfail', :bundle => false, :rvm => ['1.8.7', 'ree'] do
|
71
|
-
...
|
72
|
-
end
|
73
|
-
|
74
|
-
== Development
|
75
|
-
|
76
|
-
- Source hosted on GitHub: https://github.com/guard/guard-test
|
77
|
-
- Report issues/Questions/Feature requests on GitHub Issues: https://github.com/guard/guard-test/issues
|
78
|
-
|
79
|
-
Pull requests are very welcome!
|
80
|
-
Make sure your patches are well tested.
|
81
|
-
Please create a topic branch for every separate change you make.
|
82
|
-
|
83
|
-
== Author
|
84
|
-
|
85
|
-
{Rémy Coutable}[https://github.com/rymai]
|
86
|
-
|
87
|
-
== Kudos
|
88
|
-
|
89
|
-
Many thanks to {Thibaud Guillaume-Gentil}[https://github.com/thibaudgg] for creating the excellent Guard gem.
|
data/lib/guard/test/formatter.rb
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
module Formatter
|
2
|
-
|
3
|
-
def print_results(test_count, assertion_count, failure_count, error_count, duration, options={})
|
4
|
-
puts_with_color(duration_text(duration, options)) if options[:with_duration]
|
5
|
-
color = (failure_count > 0 ? "failure" : (error_count > 0 ? "error" : "pass"))
|
6
|
-
puts_with_color(results_text(test_count, assertion_count, failure_count, error_count), color)
|
7
|
-
end
|
8
|
-
|
9
|
-
def notify_results(test_count, assertion_count, failure_count, error_count, duration)
|
10
|
-
notify(
|
11
|
-
results_text(test_count, assertion_count, failure_count, error_count) + duration_text(duration, :short => true),
|
12
|
-
image(failure_count + error_count)
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
|
-
def print_and_notify_results(test_count, assertion_count, failure_count, error_count, duration, options={})
|
17
|
-
print_results(test_count, assertion_count, failure_count, error_count, duration, options)
|
18
|
-
notify_results(test_count, assertion_count, failure_count, error_count, duration)
|
19
|
-
end
|
20
|
-
|
21
|
-
def image(failure_count)
|
22
|
-
failure_count > 0 ? :failed : :success
|
23
|
-
end
|
24
|
-
|
25
|
-
def notify(message, image)
|
26
|
-
Guard::Notifier.notify(message, :title => "Test::Unit results", :image => image)
|
27
|
-
end
|
28
|
-
|
29
|
-
def print_with_color(something, color_name="reset")
|
30
|
-
something = "%s%s%s" % [color_sequence(color_name), something, color_sequence("reset")]
|
31
|
-
$stdout.write(something)
|
32
|
-
$stdout.flush
|
33
|
-
true
|
34
|
-
end
|
35
|
-
|
36
|
-
def puts_with_color(something, color_name="reset")
|
37
|
-
print_with_color(something, color_name)
|
38
|
-
$stdout.puts
|
39
|
-
end
|
40
|
-
|
41
|
-
private
|
42
|
-
|
43
|
-
def color_sequence(color_name="reset")
|
44
|
-
"\e[0#{color_code(color_name)}m"
|
45
|
-
end
|
46
|
-
|
47
|
-
def color_code(name="reset")
|
48
|
-
{ "pass" => ";32", "failure" => ";31", "pending" => ";33", "error" => ";35", "reset" => "" }[name]
|
49
|
-
end
|
50
|
-
|
51
|
-
def results_text(test_count, assertion_count, failure_count, error_count)
|
52
|
-
"#{test_count} tests, #{assertion_count} asserts, #{failure_count} fails, #{error_count} errors"
|
53
|
-
end
|
54
|
-
|
55
|
-
def duration_text(duration, options={})
|
56
|
-
"\n\n#{"Finished " unless options[:short]}in #{round_float(duration)} seconds\n"
|
57
|
-
end
|
58
|
-
|
59
|
-
def round_float(float, decimals=4)
|
60
|
-
if Float.instance_method(:round).arity == 0 # Ruby 1.8
|
61
|
-
factor = 10**decimals
|
62
|
-
(float*factor).round / factor.to_f
|
63
|
-
else # Ruby 1.9
|
64
|
-
float.round(decimals)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|