micro_test 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/mt +1 -0
- data/lib/micro_test/formatters/documentation.rb +64 -0
- metadata +3 -2
data/bin/mt
CHANGED
@@ -34,6 +34,7 @@ else
|
|
34
34
|
end
|
35
35
|
|
36
36
|
formatter_name = opts[:formatter] || "default"
|
37
|
+
formatter_name = "documentation" if formatter_name == "d"
|
37
38
|
formatter_path = File.join(lib_path, "micro_test", "formatters", formatter_name + ".rb")
|
38
39
|
unless File.exist?(formatter_path)
|
39
40
|
puts "#{formatter_path} not found."
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "color")
|
2
|
+
|
3
|
+
module MicroTest
|
4
|
+
class Formatter
|
5
|
+
include MicroTest::Color
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@total = 0
|
9
|
+
@passed = 0
|
10
|
+
@failed = 0
|
11
|
+
@start_time = Time.now
|
12
|
+
@current_group = ""
|
13
|
+
@failures = []
|
14
|
+
end
|
15
|
+
|
16
|
+
def header
|
17
|
+
end
|
18
|
+
|
19
|
+
def group(name)
|
20
|
+
@current_group = name
|
21
|
+
puts "\n#{name}"
|
22
|
+
end
|
23
|
+
|
24
|
+
def test(info)
|
25
|
+
@total += 1
|
26
|
+
info[:passed] ? @passed += 1 : @failed += 1
|
27
|
+
if info[:passed]
|
28
|
+
puts green(" #{info[:name]}")
|
29
|
+
else
|
30
|
+
info[:asserts].each do |assert|
|
31
|
+
next if assert[:passed]
|
32
|
+
@failures << { :group => @current_group, :name => info[:name], :assert => assert }
|
33
|
+
|
34
|
+
puts red(" #{info[:name]} (FAILED - #{@failures.count})")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def print_failures
|
40
|
+
puts "\nFailures:\n"
|
41
|
+
@failures.each_with_index do |failure, idx|
|
42
|
+
puts "\n #{idx + 1}) #{failure[:group]} #{failure[:name]}"
|
43
|
+
puts red(" Failure/Error: #{failure[:assert][:line]}")
|
44
|
+
puts cyan(" #{failure[:assert][:path]}:#{failure[:assert][:line_num]}")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def footer
|
49
|
+
if @failures.count > 0
|
50
|
+
print_failures
|
51
|
+
end
|
52
|
+
puts ""
|
53
|
+
puts "Finished in #{Time.now - @start_time} seconds"
|
54
|
+
msg = "#{@total} examples, #{@failed} failures"
|
55
|
+
if @failed > 0
|
56
|
+
puts red(msg)
|
57
|
+
else
|
58
|
+
puts msg
|
59
|
+
end
|
60
|
+
puts ""
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: micro_test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: slop
|
@@ -70,6 +70,7 @@ extra_rdoc_files: []
|
|
70
70
|
files:
|
71
71
|
- lib/micro_test/color.rb
|
72
72
|
- lib/micro_test/formatters/default.rb
|
73
|
+
- lib/micro_test/formatters/documentation.rb
|
73
74
|
- lib/micro_test/formatters/dots.rb
|
74
75
|
- lib/micro_test/formatters/min.rb
|
75
76
|
- lib/micro_test/runner.rb
|