minitest-documentation 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 22b083b54f6ddb41e1eae4099bb14b596438302c
4
- data.tar.gz: d2644d28c8bfc063d5ccb8e7b65e45fd62b31f6d
3
+ metadata.gz: 9f290d2966d836bdb4196974ec0cc30f9f959293
4
+ data.tar.gz: bfea80e6ac93a50ae9b140fd4195bdbe059601ab
5
5
  SHA512:
6
- metadata.gz: 405f1b23faca6d8888d618fd833f8fc7284dd14935b38889bda84255f6ebb6236ddb1e304bd1ca31a6a1e8951970549c26ca044286fa2625db9b8586ac88f84b
7
- data.tar.gz: 53481d606f908c4a1c0a6cb738cc19b5c295ef0723b9c92761eaaee1e9e192a9e9b1ec77560ee1797764a8ea21fa6824ab5dafa499355107383f7baf23361609
6
+ metadata.gz: e4e5ceb992a4c9541890639b833d6142361df5613287f6148a60365ffb6ee1f58a8d60cc55f881a48ae835dc18dad6310d8b9c8a5738d9b67e3a80df87a1a761
7
+ data.tar.gz: d45e93ca06f31480a7156d1872364aaef93b8088a252ea7dd9289b4ef4fd5382664ee106156fdba2fedafc8350f3ab5b391afab1c782e079ff7d24d234cc24ad
data/README.md CHANGED
@@ -68,10 +68,11 @@ Epic Fail!
68
68
  You have skipped tests. Run with --verbose for details.
69
69
  ```
70
70
 
71
- Aaaaand, it's colorized!
72
- `Pass` => Green
73
- `Skip` => Yellow
74
- `Fail` => Red
71
+ ### Color
72
+ If you add `--color` as an argument the output will be colorized
73
+ - `pass` => Green
74
+ - `skip` => Yellow
75
+ - `fail` => Red
75
76
 
76
77
  ## Contributing
77
78
 
@@ -14,24 +14,32 @@ module Minitest
14
14
  @documentation ||= false
15
15
  end
16
16
 
17
- def record result
18
- color_code = case result.result_code
19
- when "."
20
- GREEN
21
- when "E", "F"
22
- RED
23
- when "S"
24
- YELLOW
25
- end
17
+ def self.color!
18
+ @color = true
19
+ end
20
+
21
+ def self.color?
22
+ @color ||= false
23
+ end
26
24
 
25
+ def record result
27
26
  output_klass_name result.class
28
27
  test = test_name result
29
28
 
30
- io.print color_code
29
+ if self.class.color?
30
+ color_code = case result.result_code
31
+ when "."
32
+ GREEN
33
+ when "E", "F"
34
+ RED
35
+ when "S"
36
+ YELLOW
37
+ end
38
+ io.print color_code
39
+ end
40
+
31
41
  io.print " "
32
- io.puts test.
33
- sub("test_", "").
34
- gsub("_", " ")
42
+ io.puts stringify_test_name(test)
35
43
  io.print NND
36
44
  end
37
45
 
@@ -48,5 +56,11 @@ module Minitest
48
56
  def test_name o
49
57
  o.instance_variable_get "@NAME"
50
58
  end
59
+
60
+ def stringify_test_name test
61
+ test.
62
+ sub("test_", "").
63
+ gsub("_", " ")
64
+ end
51
65
  end
52
66
  end
@@ -5,6 +5,10 @@ module Minitest
5
5
  opts.on "--documentation", "Documentation formatter" do
6
6
  DocumentationReporter.documentation!
7
7
  end
8
+
9
+ opts.on "--color", "Colorize the output" do
10
+ DocumentationReporter.color!
11
+ end
8
12
  end
9
13
 
10
14
  def self.plugin_documentation_init options
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "minitest-documentation"
5
- spec.version = "0.0.2"
5
+ spec.version = "0.0.3"
6
6
  spec.authors = ["Teo Ljungberg"]
7
7
  spec.email = ["teo.ljungberg@gmail.com"]
8
8
  spec.summary = %q{Rspec like documentation for Minitest}
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.files = `git ls-files`.split($/)
14
14
  spec.require_paths = ["lib"]
15
15
 
16
- spec.add_dependency "minitest"
16
+ spec.add_dependency "minitest", "~> 5.2"
17
17
  spec.add_development_dependency "bundler", "~> 1.5"
18
18
  spec.add_development_dependency "rake"
19
19
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-documentation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Teo Ljungberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-12 00:00:00.000000000 Z
11
+ date: 2014-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '5.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '5.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement