minitest-anxious-reporter 1.0.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b1be9ce98d579d437d6dbf365d1d16fe846e61a8
4
+ data.tar.gz: 3bcb24abfe072686b6df92953c5c01feb2ca11af
5
+ SHA512:
6
+ metadata.gz: bc8e547aa029b2e93a2b66a5c144028a05d8388ca5bee5ca5de8b075a09b419c585a28790e98552610855c9c7041f7dd8852eef233d3fc74ccad4462c0d316c0
7
+ data.tar.gz: ba5de362681ba3fb8b62b1e07e7e2422a3db754a0aeac5d3ea659733560d427af1fae361e47f5ef5cd1cd709c53d69945e40331a5c61bd569fec19d3f5005275
data/.editorconfig ADDED
@@ -0,0 +1,20 @@
1
+ # EditorConfig is awesome: http://EditorConfig.org
2
+
3
+ # top-most EditorConfig file
4
+ root = true
5
+
6
+ # Unix-style newlines with a newline ending every file
7
+
8
+ [*]
9
+ indent_style = space
10
+ indent_size = 2
11
+ end_of_line = lf
12
+ charset = utf-8
13
+ trim_trailing_whitespace = true
14
+ insert_final_newline = true
15
+
16
+ [*.md]
17
+ trim_trailing_whitespace = false
18
+
19
+ [bionexo-web/db/structure.sql]
20
+ trim_trailing_whitespace = true
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,29 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ minitest-anxious-reporter (0.5.0)
5
+ ansi
6
+ minitest (~> 5.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ansi (1.4.3)
12
+ coderay (1.0.9)
13
+ method_source (0.8.2)
14
+ minitest (5.0.8)
15
+ pry (0.9.12.2)
16
+ coderay (~> 1.0.5)
17
+ method_source (~> 0.8)
18
+ slop (~> 3.4)
19
+ rake (10.1.0)
20
+ slop (3.4.6)
21
+
22
+ PLATFORMS
23
+ ruby
24
+
25
+ DEPENDENCIES
26
+ bundler (~> 1.3)
27
+ minitest-anxious-reporter!
28
+ pry
29
+ rake
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 Jason Thompson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # minitest-anxious-reporter
2
+
3
+ ![Gem Version](https://badge.fury.io/rb/minitest-anxious-reporter.png)
4
+
5
+ A more detailed reporter for minitest inspired by the documentation output of
6
+ Rspec.
7
+
8
+ ## Install
9
+
10
+ ### Requirements
11
+
12
+ This gem has not yet been tested with ruby versions previous 2.0.0-p247.
13
+
14
+ ### Installation
15
+
16
+ ```
17
+ gem install minitest-anxious-reporter
18
+ ```
19
+
20
+ Or in your gem file:
21
+
22
+ ```ruby
23
+ gem "minitest-anxious-reporter"
24
+ ```
25
+
26
+ ## Usage
27
+
28
+ Add the following to the top of your minitest file or you spec_helper file:
29
+
30
+ ```require 'minitest/anxious-reporter'```
31
+
32
+ This will replace Minitest's default reports with minitest-anxious-reporter's.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,5 @@
1
+ module Minitest
2
+ module AnxiousReporter
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,156 @@
1
+ gem "minitest"
2
+ require 'minitest/autorun'
3
+ require 'ansi/code'
4
+
5
+ module Minitest
6
+ module AnxiousReporter
7
+ require "minitest/anxious_reporter/version"
8
+
9
+ class AnxiousReporter < AbstractReporter
10
+ include ANSI::Code
11
+
12
+ attr_reader :io, :options, :results
13
+
14
+ attr_accessor :start_time, :total_time, :failures, :errors, :skips, :count,
15
+ :results
16
+
17
+ def initialize(options = {})
18
+ @io = io
19
+ @options = options
20
+ self.results = []
21
+ self.errors = 0
22
+ self.skips = 0
23
+ self.count = 0
24
+ self.failures = 0
25
+ end
26
+
27
+ def start
28
+ puts
29
+ self.start_time = Time.now
30
+ end
31
+
32
+ def record(result)
33
+ puts format_header(result)
34
+ puts format_result(result)
35
+ puts
36
+
37
+ puts failure_info(result) unless result.passed?
38
+
39
+ update_statistics(result)
40
+ end
41
+
42
+
43
+ def report
44
+ super
45
+
46
+ aggregate = self.results.group_by { |r| r.failure.class }
47
+ aggregate.default = [] # dumb. group_by should provide this
48
+
49
+ self.failures = aggregate[Assertion].size
50
+ self.errors = aggregate[UnexpectedError].size
51
+ self.skips = aggregate[Skip].size
52
+
53
+ puts
54
+ puts format_tests_run_count(count, total_time)
55
+ puts statistics
56
+ puts ANSI.red { failures_summary }
57
+ end
58
+
59
+ def passed?
60
+ self.failures + self.errors == 0
61
+ end
62
+
63
+ private
64
+
65
+ def failures_summary
66
+ filtered_results = results.dup
67
+ filtered_results.reject!(&:skipped?) unless options[:verbose]
68
+
69
+ s = filtered_results.each_with_index.map { |result, i|
70
+ "\n%3d) %s" % [i+1, result]
71
+ }.join("\n") + "\n"
72
+
73
+ s
74
+ end
75
+
76
+ def failure_info(result)
77
+ if result.error?
78
+ puts pad(format_error_info(result))
79
+ puts
80
+ elsif result.failure
81
+ result.failure.to_s.each_line {|l| puts pad(l)}
82
+ puts
83
+ end
84
+ end
85
+
86
+ def update_statistics(result)
87
+ self.count += 1
88
+ self.results << result unless result.passed? || result.skipped?
89
+ end
90
+
91
+ def statistics
92
+ "#{format_result_type('Errors', errors, :red)} #{format_divider}" + \
93
+ "#{format_result_type('Failures', failures, :red)} #{format_divider}" + \
94
+ "#{format_result_type('Skips', skips, :yellow)}"
95
+ end
96
+
97
+ def total_time
98
+ Time.now - start_time
99
+ end
100
+
101
+ #formatters
102
+ def pad(str, amount = 2)
103
+ " " * amount + str
104
+ end
105
+
106
+ def format_error_info(result)
107
+ e = result.failure.exception
108
+ bt = Minitest.filter_backtrace e.backtrace
109
+ ANSI.bold {e.class.to_s} + "\n" + pad(e.message.to_s) + "\n" + \
110
+ format_backtrace(bt)
111
+ end
112
+
113
+ def format_backtrace(bt)
114
+ output = ""
115
+ bt.each {|l| output << pad(l)}
116
+ output
117
+ end
118
+
119
+ def format_result(result)
120
+ output = ""
121
+ name = result.name
122
+
123
+ if result.passed?
124
+ output = ANSI.green {name}
125
+ else
126
+ output = ANSI.red {name}
127
+ end
128
+
129
+ pad output
130
+ end
131
+
132
+ def format_header(result)
133
+ ANSI.bold(result.class)
134
+ end
135
+
136
+ def format_tests_run_count(count, total_time)
137
+ time = ANSI.bold total_time.to_s
138
+ "#{count} tests run in #{time} seconds."
139
+ end
140
+
141
+ def format_result_type(type, count, colour)
142
+ summary = "#{type}: #{count}"
143
+
144
+ if count.zero?
145
+ return ANSI.ansi(summary, :white, :bold)
146
+ else
147
+ return ANSI.ansi(summary, colour, :bold)
148
+ end
149
+ end
150
+
151
+ def format_divider(divider = '|')
152
+ ANSI.white + ANSI.bold + " #{divider} "
153
+ end
154
+ end
155
+ end
156
+ end
@@ -0,0 +1,13 @@
1
+ require_relative 'anxious_reporter'
2
+
3
+ module Minitest
4
+ include Minitest::AnxiousReporter
5
+
6
+ def self.plugin_anxious_reporter_options(opts, options)
7
+ end
8
+
9
+ def self.plugin_anxious_reporter_init(options)
10
+ self.reporter.reporters = []
11
+ self.reporter << AnxiousReporter::AnxiousReporter.new(options)
12
+ end
13
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'minitest/anxious_reporter/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "minitest-anxious-reporter"
8
+ spec.version = Minitest::AnxiousReporter::VERSION
9
+ spec.authors = ["Gabriel Lett"]
10
+ spec.email = ["gabriel.lett.viviani@gmail.com"]
11
+ spec.description = %q{A detailed errors while in progress reporter for Minitest}
12
+ spec.summary = %q{Provides a better fail description while the tests are running.}
13
+ spec.homepage = "http://github.com/gabriellett/minitest-anxious-reporter"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.3"
21
+ spec.add_development_dependency "rake"
22
+ spec.add_development_dependency "pry"
23
+
24
+ spec.add_runtime_dependency "minitest", "~> 5.0"
25
+ spec.add_runtime_dependency "ansi"
26
+ end
metadata ADDED
@@ -0,0 +1,126 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: minitest-anxious-reporter
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Gabriel Lett
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-09-29 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.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
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
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '5.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '5.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: ansi
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: A detailed errors while in progress reporter for Minitest
84
+ email:
85
+ - gabriel.lett.viviani@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - .editorconfig
91
+ - .gitignore
92
+ - .ruby-version
93
+ - Gemfile
94
+ - Gemfile.lock
95
+ - LICENSE
96
+ - README.md
97
+ - Rakefile
98
+ - lib/minitest/anxious_reporter.rb
99
+ - lib/minitest/anxious_reporter/version.rb
100
+ - lib/minitest/anxious_reporter_plugin.rb
101
+ - minitest-anxious-reporter.gemspec
102
+ homepage: http://github.com/gabriellett/minitest-anxious-reporter
103
+ licenses:
104
+ - MIT
105
+ metadata: {}
106
+ post_install_message:
107
+ rdoc_options: []
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - '>='
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ requirements: []
121
+ rubyforge_project:
122
+ rubygems_version: 2.4.8
123
+ signing_key:
124
+ specification_version: 4
125
+ summary: Provides a better fail description while the tests are running.
126
+ test_files: []