minitest-colorize 0.0.1
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/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +9 -0
- data/lib/minitest/colorize/version.rb +5 -0
- data/lib/minitest/colorize.rb +33 -0
- data/lib/minitest-colorize.rb +1 -0
- data/minitest-colorize.gemspec +21 -0
- data/test/minitest_colorize_test.rb +38 -0
- data/test/test_helper.rb +4 -0
- metadata +87 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require "minitest/colorize/version"
|
2
|
+
|
3
|
+
module MiniTest
|
4
|
+
class Colorize
|
5
|
+
attr_accessor :io
|
6
|
+
|
7
|
+
def initialize(io)
|
8
|
+
self.io = io
|
9
|
+
end
|
10
|
+
|
11
|
+
def print(out)
|
12
|
+
if color = colors[out]
|
13
|
+
io.print "#{color}#{out}#{clear}"
|
14
|
+
else
|
15
|
+
io.print out
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def colors
|
20
|
+
{ "F" => "\e[31m", "E" => "\e[31m", "S" => "\e[33m", "." => "\e[32m" }
|
21
|
+
end
|
22
|
+
|
23
|
+
def clear
|
24
|
+
"\e[0m"
|
25
|
+
end
|
26
|
+
|
27
|
+
def method_missing(method, *args, &block)
|
28
|
+
io.send(method, *args, &block)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
MiniTest::Unit.output = MiniTest::Colorize.new(MiniTest::Unit.output)
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'minitest/colorize'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "minitest/colorize/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "minitest-colorize"
|
7
|
+
s.version = MiniTest::Colorize::VERSION
|
8
|
+
s.authors = ["Gabriel Sobrinho"]
|
9
|
+
s.email = ["gabriel.sobrinho@gmail.com"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{Colorize minitest output}
|
12
|
+
s.description = %q{Colorize minitest output}
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
|
19
|
+
s.add_dependency 'minitest', '~> 2.0'
|
20
|
+
s.add_development_dependency 'rake', '>= 0.8.7'
|
21
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class MiniTest::ColorizeTest < MiniTest::Unit::TestCase
|
4
|
+
def test_fail
|
5
|
+
assert_output "\e[31mF\e[0m" do
|
6
|
+
colorize = MiniTest::Colorize.new($stdout)
|
7
|
+
colorize.print 'F'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_error
|
12
|
+
assert_output "\e[31mE\e[0m" do
|
13
|
+
colorize = MiniTest::Colorize.new($stdout)
|
14
|
+
colorize.print 'E'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_skip
|
19
|
+
assert_output "\e[33mS\e[0m" do
|
20
|
+
colorize = MiniTest::Colorize.new($stdout)
|
21
|
+
colorize.print 'S'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_success
|
26
|
+
assert_output "\e[32m.\e[0m" do
|
27
|
+
colorize = MiniTest::Colorize.new($stdout)
|
28
|
+
colorize.print '.'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_others
|
33
|
+
assert_output "colorize" do
|
34
|
+
colorize = MiniTest::Colorize.new($stdout)
|
35
|
+
colorize.print 'colorize'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: minitest-colorize
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Gabriel Sobrinho
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-06-24 00:00:00 -03:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: minitest
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ~>
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "2.0"
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 0.8.7
|
36
|
+
type: :development
|
37
|
+
version_requirements: *id002
|
38
|
+
description: Colorize minitest output
|
39
|
+
email:
|
40
|
+
- gabriel.sobrinho@gmail.com
|
41
|
+
executables: []
|
42
|
+
|
43
|
+
extensions: []
|
44
|
+
|
45
|
+
extra_rdoc_files: []
|
46
|
+
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- Gemfile
|
50
|
+
- Rakefile
|
51
|
+
- lib/minitest-colorize.rb
|
52
|
+
- lib/minitest/colorize.rb
|
53
|
+
- lib/minitest/colorize/version.rb
|
54
|
+
- minitest-colorize.gemspec
|
55
|
+
- test/minitest_colorize_test.rb
|
56
|
+
- test/test_helper.rb
|
57
|
+
has_rdoc: true
|
58
|
+
homepage: ""
|
59
|
+
licenses: []
|
60
|
+
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: "0"
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: "0"
|
78
|
+
requirements: []
|
79
|
+
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 1.5.2
|
82
|
+
signing_key:
|
83
|
+
specification_version: 3
|
84
|
+
summary: Colorize minitest output
|
85
|
+
test_files:
|
86
|
+
- test/minitest_colorize_test.rb
|
87
|
+
- test/test_helper.rb
|