tconsole 1.1.2pre2 → 1.1.2pre3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -6,7 +6,7 @@ concerning what tests to run, and see their test output. It's also got a
6
6
  helpful reload command for when your Rails environment needs to be
7
7
  restarted.
8
8
 
9
- TConsole should work in pretty much any Unix environment and will work with apps running Ruby 1.8.7 and Ruby 1.9.3. It can be run on pretty much any test suite that uses MiniTest, including Rails test suites.
9
+ TConsole should work in pretty much any Unix environment and will work with apps running Ruby 1.9. It can be run on pretty much any test suite that uses MiniTest, including Rails test suites.
10
10
 
11
11
  See it in Action
12
12
  ------
@@ -70,7 +70,8 @@ module TConsole
70
70
  end
71
71
  end
72
72
 
73
- true
73
+ send_message(:stop)
74
+ false
74
75
  end
75
76
 
76
77
  def send_message(message, *args)
@@ -116,25 +116,34 @@ module TConsole
116
116
  end
117
117
 
118
118
  def status(io = self.output)
119
- format = "%d tests, %d assertions, "
120
119
 
121
- format << COLOR_MAP["P"] if passes > 0
122
- format << "%d passes, "
123
- format << ::Term::ANSIColor.reset if passes > 0
120
+ if test_count == 0
121
+ if !match_patterns.empty?
122
+ puts ::Term::ANSIColor.yellow("No tests were executed because no tests matching `#{match_patterns.join(", ")}` were found.")
123
+ else
124
+ puts ::Term::ANSIColor.yellow("No tests were executed.")
125
+ end
126
+ else
127
+ format = "%d tests, %d assertions, "
128
+
129
+ format << COLOR_MAP["P"] if passes > 0
130
+ format << "%d passes, "
131
+ format << ::Term::ANSIColor.reset if passes > 0
124
132
 
125
- format << COLOR_MAP["F"] if failures > 0
126
- format << "%d failures, "
127
- format << ::Term::ANSIColor.reset if failures > 0
133
+ format << COLOR_MAP["F"] if failures > 0
134
+ format << "%d failures, "
135
+ format << ::Term::ANSIColor.reset if failures > 0
128
136
 
129
- format << COLOR_MAP["E"] if errors > 0
130
- format << "%d errors, "
131
- format << ::Term::ANSIColor.reset if errors > 0
137
+ format << COLOR_MAP["E"] if errors > 0
138
+ format << "%d errors, "
139
+ format << ::Term::ANSIColor.reset if errors > 0
132
140
 
133
- format << COLOR_MAP["S"] if skips > 0
134
- format << "%d skips"
135
- format << ::Term::ANSIColor.reset if skips > 0
141
+ format << COLOR_MAP["S"] if skips > 0
142
+ format << "%d skips"
143
+ format << ::Term::ANSIColor.reset if skips > 0
136
144
 
137
- io.puts format % [test_count, assertion_count, passes, failures, errors, skips]
145
+ io.puts format % [test_count, assertion_count, passes, failures, errors, skips]
146
+ end
138
147
  end
139
148
 
140
149
  def _run_suite(suite, type)
@@ -161,7 +170,7 @@ module TConsole
161
170
  end
162
171
 
163
172
  if skip
164
- 0
173
+ nil
165
174
  else
166
175
  inst = suite.new method
167
176
  inst._assertions = 0
@@ -202,7 +211,7 @@ module TConsole
202
211
  end
203
212
  end
204
213
 
205
- return assertions.size, assertions.inject(0) { |sum, n| sum + n }
214
+ return assertions.select { |n| !n.nil? }.size, assertions.inject(0) { |sum, n| n.nil? ? sum + 0 : sum + n }
206
215
  end
207
216
 
208
217
  def puke(klass, meth, e)
@@ -108,8 +108,8 @@ module TConsole
108
108
  end
109
109
 
110
110
  if paths.length == 0
111
- puts "No test files match your requested test set: #{globs.join(",")}."
112
- puts "Skipping execution."
111
+ puts ::Term::ANSIColor.yellow("No test files match your requested test set: #{globs.join(",")}.")
112
+ puts ::Term::ANSIColor.yellow("Skipping execution.")
113
113
  return nil
114
114
  end
115
115
 
@@ -211,10 +211,17 @@ module TConsole
211
211
  puts
212
212
 
213
213
  if sorted_timings.length == 0
214
- puts "No timing data available. Be sure you've run some tests."
214
+ puts ::Term::ANSIColor.red + "No timing data available. Be sure you've run some tests." + ::Term::ANSIColor.reset
215
215
  else
216
216
  sorted_timings.reverse[0, limit].each do |timing|
217
- puts "#{"%0.6f" % timing[:time]}s #{timing[:suite]}##{timing[:method]}"
217
+ output = "#{"%0.6f" % timing[:time]}s #{timing[:name]}"
218
+ if timing[:time] > 1
219
+ print ::Term::ANSIColor.red, output, ::Term::ANSIColor.reset
220
+ else
221
+ print ::Term::ANSIColor.green, output, ::Term::ANSIColor.reset
222
+ end
223
+
224
+ print ::Term::ANSIColor.magenta, " #{last_result.elements[timing[:name]]}", ::Term::ANSIColor.reset, "\n"
218
225
  end
219
226
  end
220
227
 
@@ -59,7 +59,7 @@ module TConsole
59
59
  end
60
60
 
61
61
  def add_timing(suite, method, time)
62
- self.timings << { :suite => suite.to_s, :method => method.to_s, :time => time }
62
+ self.timings << { :name => "#{suite}##{method}", :time => time }
63
63
  end
64
64
  end
65
65
  end
@@ -1,3 +1,3 @@
1
1
  module TConsole
2
- VERSION = "1.1.2pre2"
2
+ VERSION = "1.1.2pre3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tconsole
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2pre2
4
+ version: 1.1.2pre3
5
5
  prerelease: 5
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-02 00:00:00.000000000 Z
12
+ date: 2012-05-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: term-ansicolor
16
- requirement: &70321948573900 !ruby/object:Gem::Requirement
16
+ requirement: &70265082683240 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.0.7
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70321948573900
24
+ version_requirements: *70265082683240
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: minitest
27
- requirement: &70321948573140 !ruby/object:Gem::Requirement
27
+ requirement: &70265082682460 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: 2.11.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70321948573140
35
+ version_requirements: *70265082682460
36
36
  description: ! " tconsole allows Rails developers to easily and quickly run their
37
37
  tests as a whole or in subsets. It forks the testing processes from\n a preloaded
38
38
  test environment to ensure that developers don't have to reload their entire Rails