guard-test 0.1.3 → 0.1.4
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.rdoc +8 -2
- data/lib/guard/test/formatter.rb +11 -2
- data/lib/guard/test/runner.rb +10 -3
- data/lib/guard/test/runners/default_test_unit_runner.rb +1 -1
- data/lib/guard/test/version.rb +1 -1
- metadata +38 -19
data/README.rdoc
CHANGED
@@ -60,9 +60,15 @@ Guard::Test allows you to choose between two different runners (Guard::Test's ru
|
|
60
60
|
- <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.
|
61
61
|
- <tt>'fastfail'</tt>: Display tests results as they happen and print failures/errors messages & backtraces immediately.
|
62
62
|
|
63
|
-
|
63
|
+
Available options:
|
64
64
|
|
65
|
-
|
65
|
+
:runner => 'fastfail' # default to 'default'
|
66
|
+
:bundler => false # don't use "bundle exec"
|
67
|
+
:rvm => ['1.8.7', '1.9.2'] # directly run your specs on multiple ruby
|
68
|
+
|
69
|
+
Set the desired options as follow method:
|
70
|
+
|
71
|
+
guard 'test', :runner => 'fastfail', :bundle => false, :rvm => ['1.8.7', 'ree'] do
|
66
72
|
...
|
67
73
|
end
|
68
74
|
|
data/lib/guard/test/formatter.rb
CHANGED
@@ -9,7 +9,7 @@ module Formatter
|
|
9
9
|
def notify_results(test_count, assertion_count, failure_count, error_count, duration)
|
10
10
|
notify(
|
11
11
|
results_text(test_count, assertion_count, failure_count, error_count) + duration_text(duration, :short => true),
|
12
|
-
image(failure_count)
|
12
|
+
image(failure_count + error_count)
|
13
13
|
)
|
14
14
|
end
|
15
15
|
|
@@ -53,7 +53,16 @@ private
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def duration_text(duration, options = {})
|
56
|
-
"\n\n#{"Finished " unless options[:short]}in #{duration} seconds\n"
|
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
|
57
66
|
end
|
58
67
|
|
59
68
|
end
|
data/lib/guard/test/runner.rb
CHANGED
@@ -13,13 +13,16 @@ module Guard
|
|
13
13
|
def run(paths, options = {})
|
14
14
|
message = "\n" + (options[:message] || "Running (#{@test_unit_runner} runner): #{paths.join(' ') }")
|
15
15
|
UI.info(message, :reset => true)
|
16
|
-
system(test_unit_command(paths))
|
16
|
+
system(test_unit_command(paths, options))
|
17
17
|
end
|
18
18
|
|
19
19
|
private
|
20
20
|
|
21
|
-
def test_unit_command(files)
|
22
|
-
cmd_parts = [
|
21
|
+
def test_unit_command(files, options = {})
|
22
|
+
cmd_parts = []
|
23
|
+
cmd_parts << "rvm #{options[:rvm].join(',')} exec" if options[:rvm].is_a?(Array)
|
24
|
+
cmd_parts << "bundle exec" if bundler? && options[:bundler] != false
|
25
|
+
cmd_parts << "ruby -rubygems"
|
23
26
|
cmd_parts << "-r#{File.dirname(__FILE__)}/runners/#{@test_unit_runner}_test_unit_runner"
|
24
27
|
cmd_parts << "-Itest"
|
25
28
|
cmd_parts << "-e \"%w[#{files.join(' ')}].each { |f| load f }\""
|
@@ -28,6 +31,10 @@ module Guard
|
|
28
31
|
cmd_parts.join(' ')
|
29
32
|
end
|
30
33
|
|
34
|
+
def bundler?
|
35
|
+
@bundler ||= File.exist?("#{Dir.pwd}/Gemfile")
|
36
|
+
end
|
37
|
+
|
31
38
|
end
|
32
39
|
end
|
33
40
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "#{File.dirname(__FILE__)}/../formatter"
|
2
2
|
require "#{File.dirname(__FILE__)}/../../test"
|
3
|
-
gem 'test-unit' if RUBY_VERSION
|
3
|
+
gem 'test-unit' if RUBY_VERSION >= '1.9' # Thanks Aaron! http://redmine.ruby-lang.org/issues/show/3561
|
4
4
|
require 'test/unit'
|
5
5
|
require 'test/unit/ui/console/testrunner'
|
6
6
|
|
data/lib/guard/test/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "R\xC3\xA9my Coutable"
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-12-15 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,58 +26,77 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 19
|
30
30
|
segments:
|
31
31
|
- 0
|
32
32
|
- 2
|
33
|
-
|
33
|
+
- 2
|
34
|
+
version: 0.2.2
|
34
35
|
type: :runtime
|
35
36
|
version_requirements: *id001
|
36
37
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
38
|
+
name: test-unit
|
38
39
|
prerelease: false
|
39
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
41
|
none: false
|
41
42
|
requirements:
|
42
43
|
- - ~>
|
43
44
|
- !ruby/object:Gem::Version
|
44
|
-
hash:
|
45
|
+
hash: 1
|
45
46
|
segments:
|
47
|
+
- 2
|
46
48
|
- 1
|
47
|
-
|
48
|
-
|
49
|
-
type: :development
|
49
|
+
version: "2.1"
|
50
|
+
type: :runtime
|
50
51
|
version_requirements: *id002
|
51
52
|
- !ruby/object:Gem::Dependency
|
52
|
-
name:
|
53
|
+
name: bundler
|
53
54
|
prerelease: false
|
54
55
|
requirement: &id003 !ruby/object:Gem::Requirement
|
55
56
|
none: false
|
56
57
|
requirements:
|
57
58
|
- - ~>
|
58
59
|
- !ruby/object:Gem::Version
|
59
|
-
hash:
|
60
|
+
hash: 25
|
60
61
|
segments:
|
61
|
-
-
|
62
|
+
- 1
|
62
63
|
- 0
|
63
|
-
|
64
|
+
- 7
|
65
|
+
version: 1.0.7
|
64
66
|
type: :development
|
65
67
|
version_requirements: *id003
|
66
68
|
- !ruby/object:Gem::Dependency
|
67
|
-
name:
|
69
|
+
name: guard-rspec
|
68
70
|
prerelease: false
|
69
71
|
requirement: &id004 !ruby/object:Gem::Requirement
|
70
72
|
none: false
|
71
73
|
requirements:
|
72
74
|
- - ~>
|
73
75
|
- !ruby/object:Gem::Version
|
74
|
-
hash:
|
76
|
+
hash: 9
|
75
77
|
segments:
|
76
|
-
-
|
78
|
+
- 0
|
77
79
|
- 1
|
78
|
-
|
80
|
+
- 9
|
81
|
+
version: 0.1.9
|
79
82
|
type: :development
|
80
83
|
version_requirements: *id004
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: rspec
|
86
|
+
prerelease: false
|
87
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ~>
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
hash: 3
|
93
|
+
segments:
|
94
|
+
- 2
|
95
|
+
- 3
|
96
|
+
- 0
|
97
|
+
version: 2.3.0
|
98
|
+
type: :development
|
99
|
+
version_requirements: *id005
|
81
100
|
description: Guard::Test automatically run your tests and notify you of the result when a file is modified.
|
82
101
|
email:
|
83
102
|
- rymai@rymai.com
|