minitest-reporters-fail 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.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NjkyNTE0ZGZlZWM3MGFjMzBlMDE3OWI4Yzg2MTk5Mjc5ZDZiMDM0ZA==
5
+ data.tar.gz: !binary |-
6
+ ZWEzMzY3N2RmNzdkYWE5YzJhMzEyZjAzYjNmZDk5M2YwNmFmZGI1YQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ YjNkM2FmOThmMGJjNjgwZWNhN2IzOWY3YTI2MzE1NmEzZWI3NzA4OGE0NTNk
10
+ OWZmZGIyYjk0OWU2YzA0ODRmNDA3NmYxYWMyNDcxZjQ2NzBjYzQ4YTZjYTRm
11
+ YTMwMzY5OTc2NDRmYzMyYjM1NjVjZWI1ZGMwN2Y0ODY0ODM0MDM=
12
+ data.tar.gz: !binary |-
13
+ MjUxMzk5ZGEzZTcxMjY5YzJhMDQ1ZDcwZTNkZWVmZDg4MGJkZjliODdlZmNh
14
+ ZWI5NzU2ZjQyYjA2ZWY1Zjk2NzJiYmJiYzFkZmY2M2IyZjc4NzY0N2NkYTlk
15
+ ZTRmODViMTU5ZjEyZGYwZTMzZjA2MjQ4MjBhNmQ5OTkzMDY3ZTM=
data/.gitignore ADDED
@@ -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,33 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in minitest-reporters-fail.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem 'guard'
8
+ gem 'guard-minitest'
9
+
10
+ gem 'pry'
11
+ gem 'rake'
12
+ gem 'minitest'
13
+ gem 'minitest-matchers'
14
+
15
+ gem 'minitest-reporters'
16
+ gem 'mocha'
17
+ gem 'hashie', git: 'https://github.com/intridea/hashie'
18
+ end
19
+
20
+ if RbConfig::CONFIG['target_os'] =~ /darwin/i
21
+ gem 'rb-fsevent', '>= 0.3.2'
22
+ gem 'growl', '~> 1.0.3'
23
+ end
24
+ if RbConfig::CONFIG['target_os'] =~ /linux/i
25
+ gem 'rb-inotify', '>= 0.5.1'
26
+ gem 'libnotify', '~> 0.1.3'
27
+ end
28
+ if RbConfig::CONFIG['target_os'] =~ /mswin|mingw/i
29
+ gem 'win32console', :require => false
30
+ gem 'rb-fchange', '~> 0.0.2', :require => false
31
+ gem 'rb-notifu', '~> 0.0.4', :require => false
32
+ end
33
+
data/Guardfile ADDED
@@ -0,0 +1,7 @@
1
+ guard 'minitest',
2
+ :notify => true do
3
+ # with Minitest::Spec
4
+ watch(%r|^spec/(.*)_spec\.rb|)
5
+ watch(%r|^lib/(.*)\.rb|) { |m| "spec/#{m[1]}_spec.rb" }
6
+ watch(%r|^spec/spec_helper\.rb|) { "spec" }
7
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 David Conner
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,25 @@
1
+ # Minitest::Reporters::Fail
2
+
3
+ Add this to test/support/minitest_reporters.rb:
4
+
5
+ ```ruby
6
+ # may want to skip this for CI!
7
+ require "minitest/reporters"
8
+ require 'minitest/reporters/fail'
9
+ emoji = {
10
+ 'P' => "\u{1F49A} ", # heart
11
+ 'E' => "\u{1f525} ", # flame
12
+ 'F' => "\u{1f4a9} ", # poop
13
+ 'S' => "\u{1f37a} "} # beer
14
+
15
+ MiniTest::Reporters.use! Minitest::Reporters::FailReporter.new(emoji: emoji)
16
+ ```
17
+
18
+ To run tests:
19
+
20
+ ```shell
21
+ bundle install
22
+ guard
23
+ # [enter]
24
+ ```
25
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,138 @@
1
+ #require 'minitest/unit'
2
+ require 'ansi/code'
3
+ require 'minitest/reporters'
4
+
5
+ module Minitest
6
+ module Reporters
7
+
8
+ # A reporter based on minitest-emoji by tenderlove
9
+ # and on minitest-reporters by CapnKernul
10
+ #
11
+ # @see https://github.com/tenderlove/minitest-emoji
12
+ # @see https://github.com/CapnKernul/minitest-reporters
13
+ class FailReporter
14
+ # hmmm, when using bundler to require from source,
15
+ # fully qualified namespace is required, with ::
16
+ # and require 'ansi/code' is needed
17
+ include ::Minitest::Reporter
18
+ include ::ANSI::Code
19
+ include ::Minitest::RelativePosition
20
+
21
+ EMOJI = {
22
+ 'P' => "\u{1F49A} ", # heart
23
+ 'E' => "\u{1f525} ", # flame
24
+ 'F' => "\u{1f4a9} ", # poop
25
+ 'S' => "\u{1f37a} " # beer
26
+ }
27
+
28
+ def initialize(opts = {})
29
+ @emoji = EMOJI.merge(opts.fetch(:emoji, {}))
30
+ init_counts
31
+ init_suite_counts
32
+ end
33
+
34
+ def init_suite_counts
35
+ @suites_test_count = 0
36
+ @suites_results = {
37
+ 'P' => 0,
38
+ 'E' => 0,
39
+ 'F' => 0,
40
+ 'S' => 0 }
41
+ end
42
+
43
+ def init_counts
44
+ @test_count = 0
45
+ @results = {
46
+ 'P' => 0,
47
+ 'E' => 0,
48
+ 'F' => 0,
49
+ 'S' => 0 }
50
+ end
51
+
52
+ def before_suites(suite, type)
53
+ init_suite_counts
54
+ end
55
+
56
+ def after_suites(suites, type)
57
+ puts "FINISHED - #{@suites_test_count} tests ran"
58
+ %w(P E F S).each do |status|
59
+ print("#{@emoji[status]} => " + @emoji[status]*@suites_results[status] + " #{@suites_results[status]}")
60
+ puts;
61
+ end
62
+ end
63
+
64
+ def before_suite(suite)
65
+ init_counts
66
+ end
67
+
68
+ def after_suite(suite)
69
+ if @test_count > 1
70
+ @suites_results.each_key { |k| @suites_results[k] += @results[k] }
71
+
72
+ puts "#{@test_count} Tests - #{suite}"
73
+ %w(P E F S).each do |status|
74
+ print("#{@emoji[status]} => " + @emoji[status]*@results[status] + " #{@results[status]}")
75
+ puts;
76
+ end
77
+ end
78
+ end
79
+
80
+ def before_test(suite,test)
81
+ #FIX_FOR_ZEUS!! (which seems to want to run tests twice)
82
+ # on the second run,
83
+ # these are still nil,
84
+ # for some reason
85
+ # oh i wish i knew why!
86
+ @test_count ||= 0
87
+ @suite_test_count ||= 0
88
+ end
89
+
90
+ def after_test(suite,test)
91
+ @test_count += 1
92
+ @suite_test_count += 1
93
+ end
94
+
95
+ def pass(suite, test, test_runner)
96
+ @results['P'] += 1
97
+ end
98
+
99
+ def skip(suite, test, test_runner)
100
+ @results['S'] += 1
101
+ puts; print(@emoji['S'] + yellow { pad_mark("#{print_time(test)} SKIP") } )
102
+ puts; print(yellow { pad_mark(suite) } )
103
+ puts; print(yellow { pad_mark(test) } )
104
+ end
105
+
106
+ def failure(suite,test,test_runner)
107
+ @results['F'] += 1
108
+ puts; print(@emoji['F'] + red { pad_mark("#{print_time(test)} FAIL") } )
109
+ puts; print(red { pad_mark(suite) } )
110
+ puts; print(red { pad_mark(test) } )
111
+ puts; print_info(test_runner.exception)
112
+ end
113
+
114
+ def error(suite,test,test_runner)
115
+ @results['E'] += 1
116
+ puts; print(@emoji['E'] + red { pad_mark("#{print_time(test)} ERROR") } )
117
+ puts; print(red { pad_mark(suite) } )
118
+ puts; print(red { pad_mark(test) } )
119
+ puts; print_info(test_runner.exception)
120
+ end
121
+
122
+ private
123
+
124
+ def print_time(test)
125
+ total_time = Time.now - (runner.test_start_time || Time.now)
126
+ " (%.2fs)" % total_time
127
+ end
128
+
129
+ def print_info(e)
130
+ e.message.each_line { |line| print_with_info_padding(line) }
131
+
132
+ trace = filter_backtrace(e.backtrace)
133
+ trace.each { |line| print_with_info_padding(line) }
134
+ end
135
+
136
+ end
137
+ end
138
+ end
@@ -0,0 +1,8 @@
1
+
2
+ module Minitest
3
+ module Reporters
4
+ module Fail
5
+ VERSION = "0.0.1"
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'minitest/reporters/fail/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "minitest-reporters-fail"
7
+ spec.version = Minitest::Reporters::Fail::VERSION
8
+ spec.authors = ["David Conner"]
9
+ spec.email = ["dconner.pro@gmail.com"]
10
+ spec.description = %q{A Minitest Reporter that Shows Failure Detail and Emoji}
11
+ spec.summary = %q{A Minitest Reporter that Shows Failure Detail and Emoji!}
12
+ spec.homepage = "https://github.com/dcunited001/minitest-reporters-fail"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "minitest-reporters", ">= 0.14"
21
+ spec.add_dependency 'ansi'
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
25
+ end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Passing Tests" do
4
+ it "passes 1" do
5
+ 1.must_equal 1
6
+ end
7
+ it "passes 2" do
8
+ 2.must_equal 2
9
+ end
10
+ it "passes 3" do
11
+ 3.must_equal 3
12
+ end
13
+ end
14
+
15
+ describe "Failing Tests" do
16
+ it "fails 1" do
17
+ 1.must_equal 3
18
+ end
19
+ it "passes 2" do
20
+ 2.must_equal 2
21
+ end
22
+ it "fails 3" do
23
+ 3.must_equal 1
24
+ end
25
+ end
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+
4
+ require "minitest/spec"
5
+ #require "mocha"
6
+ #require "pry"
7
+
8
+ # in test/support/minitest_reporters.rb
9
+ require "minitest/reporters"
10
+ require 'minitest/reporters/fail'
11
+ emoji = {
12
+ 'P' => "\u{1F49A} ", # heart
13
+ 'E' => "\u{1f525} ", # flame
14
+ 'F' => "\u{1f4a9} ", # poop
15
+ 'S' => "\u{1f37a} "} # beer
16
+
17
+ MiniTest::Reporters.use! Minitest::Reporters::FailReporter.new(emoji: emoji)
18
+
19
+ def this
20
+ Minitest::Reporters::FailReporter
21
+ end
22
+
23
+ def root_path
24
+ File.dirname(__FILE__)
25
+ end
26
+
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: minitest-reporters-fail
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - David Conner
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-03-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: minitest-reporters
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0.14'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0.14'
27
+ - !ruby/object:Gem::Dependency
28
+ name: ansi
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
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: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: A Minitest Reporter that Shows Failure Detail and Emoji
70
+ email:
71
+ - dconner.pro@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - Gemfile
78
+ - Guardfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - lib/minitest/reporters/fail.rb
83
+ - lib/minitest/reporters/fail/version.rb
84
+ - minitest-reporters-fail.gemspec
85
+ - spec/minitest/reporters/fail_spec.rb
86
+ - spec/spec_helper.rb
87
+ homepage: https://github.com/dcunited001/minitest-reporters-fail
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.0.0
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: A Minitest Reporter that Shows Failure Detail and Emoji!
111
+ test_files:
112
+ - spec/minitest/reporters/fail_spec.rb
113
+ - spec/spec_helper.rb