turn-again-reporter 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a5d845ae193881f75e410ab3b897dd1a42cf30d9
4
+ data.tar.gz: c892bb163cfb4d9f4076800c1bbf3da75f6c40a7
5
+ SHA512:
6
+ metadata.gz: 85c0dd4857122866b72f3ac8f2b7dd92f4549a83543556e3bf37179e37d7bb62fd661098ba89d5f414b4b935d1aa94d6c5f468597c360c587c58f9f241fb5f08
7
+ data.tar.gz: 60fb499620e93d297a3bb0b22ccc9cd87f521027e8fc2e117cd19380ba0c3372862a4f930f1647d6b040138380a26b8b8fe35bf01491c245cd9c778aebf83702
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in turn-again-reporter.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Paul Kwiatkowski
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.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # Turn::Again::Reporter
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'turn-again-reporter'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install turn-again-reporter
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/turn-again-reporter/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,87 @@
1
+ module Minitest
2
+ module Reporters
3
+ # Reporter whose output more closely mimics the format of the turn gem.
4
+ # Specifically:
5
+ # 1. The status banner and time on the left, which removes the need to
6
+ # limit the length of test names to not risk mis-aligning status flags.
7
+ # 2. Displays time as minutes:seconds, optionally with hours as well.
8
+ # 3. Allows configuration of indentation for each test output. Turn uses
9
+ # 4 spaces, and thus this was chosen as the default.
10
+ #
11
+ # Source is mostly a verbatim copy from minitest-reporter's
12
+ # SpecReporter class. Was unable to simply subclass SpecReporter without
13
+ # significant code gynmastics or metaprogramming unbecoming of a simple
14
+ # library formatter. This mostly due to SpecReporter's necessary
15
+ # calls to super within the #record method, mixed with unavoidable output.
16
+ #
17
+ # @see https://github.com/kern/minitest-reporters/blob/master/lib/minitest/reporters/spec_reporter.rb SpecReporter
18
+ # @see https://github.com/TwP/turn turn
19
+ class TurnAgainReporter < BaseReporter
20
+ include ANSI::Code
21
+ include RelativePosition
22
+
23
+ attr_reader :hours, :indent
24
+
25
+ def initialize(options = {})
26
+ @hours = !!options.fetch(:hours, false)
27
+ @indent = options.fetch(:indent, 4)
28
+ super(options)
29
+ end
30
+
31
+ def start
32
+ super
33
+ puts('Started with run options %s' % options[:args])
34
+ puts
35
+ end
36
+
37
+ def report
38
+ super
39
+ puts('Finished in %.5fs' % total_time)
40
+ print('%d tests, %d assertions, ' % [count, assertions])
41
+ color = failures.zero? && errors.zero? ? :green : :red
42
+ print(send(color) { '%d failures, %d errors, ' } % [failures, errors])
43
+ print(yellow { '%d skips' } % skips)
44
+ puts
45
+ end
46
+
47
+ def record(test)
48
+ super
49
+ print (' ' * indent)
50
+ print_colored_status(test)
51
+ print format_time(test.time)
52
+ print test.name
53
+ puts
54
+ if !test.skipped? && test.failure
55
+ print_info(test.failure)
56
+ puts
57
+ end
58
+ end
59
+
60
+ protected ######################################################################
61
+
62
+ def before_suite(suite)
63
+ puts suite
64
+ end
65
+
66
+ def after_suite(suite)
67
+ puts
68
+ end
69
+
70
+ def format_time(t)
71
+ if hours
72
+ ' (%02d:%02d:%06.3f) ' % [
73
+ t.to_i / 3600, # hours
74
+ (t.to_i % 3600) / 60, # mins
75
+ t % 60, # seconds (kept as float)
76
+ ]
77
+ else
78
+ ' (%02d:%06.3f) ' % [
79
+ (t.to_i % 3600) / 60, # mins
80
+ t % 60 # seconds (kept as float)
81
+ ]
82
+ end
83
+ end
84
+
85
+ end
86
+ end
87
+ end
data/lib/version.rb ADDED
@@ -0,0 +1,10 @@
1
+ require "minitest/reporters"
2
+ require "minitest/reporters/turn_again_reporter"
3
+
4
+ module Minitest
5
+ module Reporters
6
+ class TurnAgainReporter
7
+ VERSION = "0.0.1"
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "turn-again-reporter"
8
+ spec.version = Minitest::Reporters::TurnAgainReporter::VERSION
9
+ spec.platform = Gem::Platform::RUBY
10
+ spec.authors = ["Paul Kwiatkowski"]
11
+ spec.email = ["paul@groupraise.com"]
12
+ spec.summary = %q{A reporter for the minitest-reporters gem that more accurately mimics the behavior of the turn gem.}
13
+ spec.description = %q{A reporter for the minitest-reporters gem that more accurately mimics the behavior of the turn gem. Specifically, the test's status banner is now on the left, removing the need to limit the length of test names for the sake of aesthetics and readability (as in the case of Minitest::Reporters::SpecReporter included with the minitest-reporters gem).}
14
+ spec.homepage = "https://github.com/swifthand/turn-again-reporter"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+
24
+ spec.add_runtime_dependency "minitest-reporters", "~> 1.0", ">= 1.0.11"
25
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: turn-again-reporter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Paul Kwiatkowski
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest-reporters
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 1.0.11
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '1.0'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 1.0.11
61
+ description: A reporter for the minitest-reporters gem that more accurately mimics
62
+ the behavior of the turn gem. Specifically, the test's status banner is now on the
63
+ left, removing the need to limit the length of test names for the sake of aesthetics
64
+ and readability (as in the case of Minitest::Reporters::SpecReporter included with
65
+ the minitest-reporters gem).
66
+ email:
67
+ - paul@groupraise.com
68
+ executables: []
69
+ extensions: []
70
+ extra_rdoc_files: []
71
+ files:
72
+ - ".gitignore"
73
+ - Gemfile
74
+ - LICENSE.txt
75
+ - README.md
76
+ - Rakefile
77
+ - lib/minitest/reporters/turn_again_reporter.rb
78
+ - lib/version.rb
79
+ - turn-again-reporter.gemspec
80
+ homepage: https://github.com/swifthand/turn-again-reporter
81
+ licenses:
82
+ - MIT
83
+ metadata: {}
84
+ post_install_message:
85
+ rdoc_options: []
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubyforge_project:
100
+ rubygems_version: 2.4.4
101
+ signing_key:
102
+ specification_version: 4
103
+ summary: A reporter for the minitest-reporters gem that more accurately mimics the
104
+ behavior of the turn gem.
105
+ test_files: []