minitest-documentation 0.0.2

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 22b083b54f6ddb41e1eae4099bb14b596438302c
4
+ data.tar.gz: d2644d28c8bfc063d5ccb8e7b65e45fd62b31f6d
5
+ SHA512:
6
+ metadata.gz: 405f1b23faca6d8888d618fd833f8fc7284dd14935b38889bda84255f6ebb6236ddb1e304bd1ca31a6a1e8951970549c26ca044286fa2625db9b8586ac88f84b
7
+ data.tar.gz: 53481d606f908c4a1c0a6cb738cc19b5c295ef0723b9c92761eaaee1e9e192a9e9b1ec77560ee1797764a8ea21fa6824ab5dafa499355107383f7baf23361609
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in minitest-documentation.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Teo Ljungberg
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,82 @@
1
+ # Minitest::Documentation
2
+
3
+ A documentation format for [minitest](https://github.com/seattlerb/minitest)
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'minitest-documentation'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install minitest-documentation
18
+
19
+ ## Requirements
20
+
21
+ Minitest >= 5.0.0
22
+
23
+ ## Usage
24
+
25
+ Just pass `--documentation` as an argument while running your tests
26
+
27
+ ## What's the difference?
28
+
29
+ ```bash
30
+ Run options: --documentation --seed 17962
31
+
32
+ # Running:
33
+
34
+ ExampleTest
35
+ flunk
36
+ pass
37
+ skip
38
+
39
+
40
+ Finished in 0.001199s, 2502.0851 runs/s, 1668.0567 assertions/s.
41
+
42
+ 1) Failure:
43
+ ExampleTest#test_flunk [example_test.rb:9]:
44
+ Epic Fail!
45
+
46
+ 3 runs, 2 assertions, 1 failures, 0 errors, 1 skips
47
+
48
+ You have skipped tests. Run with --verbose for details.
49
+ ```
50
+
51
+ vs
52
+
53
+ ```bash
54
+ Run options: --seed 51722
55
+
56
+ # Running:
57
+
58
+ SF.
59
+
60
+ Finished in 0.001132s, 2650.1767 runs/s, 1766.7845 assertions/s.
61
+
62
+ 1) Failure:
63
+ ExampleTest#test_flunk [example_test.rb:9]:
64
+ Epic Fail!
65
+
66
+ 3 runs, 2 assertions, 1 failures, 0 errors, 1 skips
67
+
68
+ You have skipped tests. Run with --verbose for details.
69
+ ```
70
+
71
+ Aaaaand, it's colorized!
72
+ `Pass` => Green
73
+ `Skip` => Yellow
74
+ `Fail` => Red
75
+
76
+ ## Contributing
77
+
78
+ 1. Fork it ( http://github.com/teoljungberg/minitest-documentation/fork )
79
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
80
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
81
+ 4. Push to the branch (`git push origin my-new-feature`)
82
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,15 @@
1
+ require 'minitest/autorun'
2
+
3
+ class ExampleTest < Minitest::Test
4
+ def test_pass
5
+ pass
6
+ end
7
+
8
+ def test_flunk
9
+ flunk
10
+ end
11
+
12
+ def test_skip
13
+ skip
14
+ end
15
+ end
@@ -0,0 +1,52 @@
1
+ module Minitest
2
+ class DocumentationReporter < Reporter
3
+ ESC = "\e["
4
+ NND = "#{ESC}0m"
5
+ GREEN = "#{ESC}32m"
6
+ RED = "#{ESC}31m"
7
+ YELLOW = "#{ESC}33m"
8
+
9
+ def self.documentation!
10
+ @documentation = true
11
+ end
12
+
13
+ def self.documentation?
14
+ @documentation ||= false
15
+ end
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
26
+
27
+ output_klass_name result.class
28
+ test = test_name result
29
+
30
+ io.print color_code
31
+ io.print " "
32
+ io.puts test.
33
+ sub("test_", "").
34
+ gsub("_", " ")
35
+ io.print NND
36
+ end
37
+
38
+ private
39
+ attr_accessor :klass
40
+
41
+ def output_klass_name k
42
+ if k != klass
43
+ self.klass = k
44
+ io.puts klass
45
+ end
46
+ end
47
+
48
+ def test_name o
49
+ o.instance_variable_get "@NAME"
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,17 @@
1
+ require 'minitest/documentation'
2
+
3
+ module Minitest
4
+ def self.plugin_documentation_options opts, options
5
+ opts.on "--documentation", "Documentation formatter" do
6
+ DocumentationReporter.documentation!
7
+ end
8
+ end
9
+
10
+ def self.plugin_documentation_init options
11
+ return unless DocumentationReporter.documentation?
12
+
13
+ io = options.delete(:io) || $stdout
14
+ self.reporter.reporters.reject! {|o| o.is_a? ProgressReporter }
15
+ self.reporter.reporters << DocumentationReporter.new(io, options)
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ # coding: utf-8
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "minitest-documentation"
5
+ spec.version = "0.0.2"
6
+ spec.authors = ["Teo Ljungberg"]
7
+ spec.email = ["teo.ljungberg@gmail.com"]
8
+ spec.summary = %q{Rspec like documentation for Minitest}
9
+ spec.description = spec.summary
10
+ spec.homepage = "https://github.com/teoljungberg/minitest-documentation"
11
+ spec.license = "MIT"
12
+
13
+ spec.files = `git ls-files`.split($/)
14
+ spec.require_paths = ["lib"]
15
+
16
+ spec.add_dependency "minitest"
17
+ spec.add_development_dependency "bundler", "~> 1.5"
18
+ spec.add_development_dependency "rake"
19
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: minitest-documentation
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Teo Ljungberg
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: minitest
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.5'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Rspec like documentation for Minitest
56
+ email:
57
+ - teo.ljungberg@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - example_test.rb
68
+ - lib/minitest/documentation.rb
69
+ - lib/minitest/documentation_plugin.rb
70
+ - minitest-documentation.gemspec
71
+ homepage: https://github.com/teoljungberg/minitest-documentation
72
+ licenses:
73
+ - MIT
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 2.2.0
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: Rspec like documentation for Minitest
95
+ test_files: []