turn-again-reporter 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 89e66ba1383289ca4a09134f2f4737d7796c2cb2
4
- data.tar.gz: 4a68013f0dc01ade97ba88e1ba27d9675f4fd365
3
+ metadata.gz: 743272e9560671bd13044dc51cd842bd2774b48a
4
+ data.tar.gz: 380c1e65d86cd26c0fe6f8b31ffa94143c94c158
5
5
  SHA512:
6
- metadata.gz: 521b108905f19251ad376fee65ba289da0e051d0871be02789c72cfef6c3ef50d688eb3ad7b47f87d7cf9fc326335897d973970a89fafc67af852b9f5b340c04
7
- data.tar.gz: 086482878cecd8cbf1c8bba1222c63e6f6c98a53e096c9e09d096b8afc631f3ecb6034b1555f566a1230e5c83394cfcd9db9818ec7fdbe522cecb8902ec84004
6
+ metadata.gz: 9527c77c41d1bd49c36ed679f6625541fc3f983f33884fed9c88bbd5cfd4a49166daceb1904f25efacd94b6ed3c90117f5892d596f1816c6d6a698056e3b6f54
7
+ data.tar.gz: 02700143e065b56797b32169c995c02aed5f1b6623b4d7b6438cec35c71cc20ddc2a1ffe34438c5a03e5dfea234ce612496b19e61f122d690149b3712e11eec2
data/.gitignore CHANGED
@@ -13,3 +13,5 @@
13
13
  *.a
14
14
  mkmf.log
15
15
  *.gem
16
+ .ruby-version
17
+ .ruby-gemset
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # A Turn-like Minitest Reporter (Again)
2
2
 
3
- One of my favorite aspects of the now-abandoned [turn gem](https://github.com/turn-project/turn) was how the status banners for each test (i.e. PASS, FAIL, ERROR, SKIP) lined up nicely on the right side, providing a comfy, at-a-glance view.
3
+ One of my favorite aspects of the now-abandoned [turn gem](https://github.com/turn-project/turn) was how the status banners for each test (i.e. PASS, FAIL, ERROR, SKIP) lined up nicely on the left side, providing a comfy, at-a-glance view.
4
4
 
5
5
  These days I'm using the [minitest-reporters](https://github.com/kern/minitest-reporters) gem everywhere, but I've felt a little picky about the SpecReporter's claims to be "Turn-like". In addition to the right-aligned status banners being a little unfamiliar, since they come after the test name, it has the undesirable effect of limiting the length of my test names.
6
6
 
@@ -10,6 +10,7 @@ These days I'm using the [minitest-reporters](https://github.com/kern/minitest-r
10
10
 
11
11
  This might be better off included in the minitest-reporters gem itself, but it varies so minimally/cosmetically from its parent that I can't bring myself to bother the wonderful [Alex Kern](https://github.com/kern) about it with a pull request. It's really just an easy way for me to spread this code across all my projects without copy-pasting it. If someone else out there enjoys this formatting, I'm glad to hear it.
12
12
 
13
+
13
14
  ## Usage and Features (so-called)
14
15
 
15
16
  In your `test_helper.rb` file, or equivalent where you `require 'minitest-reporters'`, just follow it up with:
@@ -20,7 +21,7 @@ require 'minitest/reporters'
20
21
  Minitest::Reporters.use! Minitest::Reporters::TurnAgainReporter.new
21
22
  ```
22
23
 
23
- TurnAgainReporter's initializer will pass on all existing Minitest::Reporters::Base keyword argments, such as `color: true` but uses two of its own for some customization:
24
+ TurnAgainReporter's initializer will pass on all existing Minitest::Reporters::Base keyword arguments, such as `color: true` but uses two of its own for some customization:
24
25
 
25
26
  1. The `indent` keyword can specify the indentation from the left of the console when running. The default is 4 to faithfully mimic turn itself.
26
27
  2. *Unlike turn*, the duration measurements in next to the test status do not include hours, because the vast majority of tests do not require a whole hour for a single test case. However, hours can be re-enabled by passing the `:hours` keyword as `true`.
@@ -35,6 +36,12 @@ Minitest::Reporters.use!(
35
36
  ))
36
37
  ```
37
38
 
39
+
40
+ ## Demonstration tests
41
+
42
+ Rake test tasks exist for demonstrating the output of this gem. The usual `rake test` task will simply run all of the demonstration files. Because this necessarily includes purposeful errors and failures, will fail. Please do not file any issues related to these intended failures. More granularly, there are tasks with the names `pass-format`, `fail-format`, `error-format` and `skip-format` which demonstrate their respective formatting.
43
+
44
+
38
45
  ## Installation
39
46
 
40
47
  The usual gem installation applies:
@@ -55,8 +62,9 @@ and run
55
62
  $ bundle install
56
63
  ```
57
64
 
65
+
58
66
  ## Contributing
59
67
 
60
- Fork away, but I can't imaginee there's much to contribute.
68
+ Fork away, but I can't imagine there's much to contribute.
61
69
 
62
70
  That said, I would be interested to see how one might test the output of a test library? Play with redirecting STDOUT and write a few test cases for Fixnum or something? I would normally shy away from releasing untested code, but *honestly?!* This gem is just two `sprintf` statements and a re-arrangement of `puts` statements.
data/Rakefile CHANGED
@@ -1,2 +1,27 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rake/testtask"
2
3
 
4
+ Rake::TestTask.new do |t|
5
+ t.libs << "test"
6
+ t.test_files = Dir[File.join(File.dirname(__FILE__), 'test/**/*test.rb')]
7
+ end
8
+
9
+ Rake::TestTask.new("pass-format") do |t|
10
+ t.libs << "test"
11
+ t.test_files = [File.join(File.dirname(__FILE__), 'test/integration/pass_format_test.rb')]
12
+ end
13
+
14
+ Rake::TestTask.new("fail-format") do |t|
15
+ t.libs << "test"
16
+ t.test_files = [File.join(File.dirname(__FILE__), 'test/integration/fail_format_test.rb')]
17
+ end
18
+
19
+ Rake::TestTask.new("error-format") do |t|
20
+ t.libs << "test"
21
+ t.test_files = [File.join(File.dirname(__FILE__), 'test/integration/error_format_test.rb')]
22
+ end
23
+
24
+ Rake::TestTask.new("skip-format") do |t|
25
+ t.libs << "test"
26
+ t.test_files = [File.join(File.dirname(__FILE__), 'test/integration/skip_format_test.rb')]
27
+ end
@@ -1,7 +1,36 @@
1
+ ##
2
+ # So the convention of burying a VERSION constant inside a .version file
3
+ # and requiring it from within a gemspec breaks down when the namespace you
4
+ # need to bury it in has a dependency on (i.e. inherits from) some
5
+ # yet-to-be-loaded class.
6
+ #
7
+ # Consequently, we have an ugly shim to set up the heirarchy that Minitest
8
+ # should later fill in and use.
9
+ unless defined?(Minitest::StatisticsReporter)
10
+ module Minitest
11
+ class AbstractReporter; end
12
+ class Reporter < AbstractReporter; end
13
+ class StatisticsReporter < Reporter; end
14
+ end
15
+ end
16
+
17
+ ##
18
+ # Which is just an opening act for the hierarchy that Minitest::Reporters uses.
19
+ unless defined?(Minitest::Reporters::BaseReporter)
20
+ module Minitest
21
+ module Reporters
22
+ class BaseReporter < Minitest::StatisticsReporter; end
23
+ end
24
+ end
25
+ end
26
+
27
+ ##
28
+ # And now we can safely declare a version deep inside something that needs to
29
+ # inherit from Minitest::Reporters::BaseReporter.
1
30
  module Minitest
2
31
  module Reporters
3
32
  class TurnAgainReporter < BaseReporter
4
- VERSION = "1.0.1"
33
+ VERSION = "1.0.2"
5
34
  end
6
35
  end
7
36
  end
@@ -1,5 +1,6 @@
1
1
  require 'minitest'
2
2
  require 'minitest/reporters'
3
+ require 'minitest/reporters/base_reporter'
3
4
 
4
5
  module Minitest
5
6
  module Reporters
@@ -22,6 +23,7 @@ module Minitest
22
23
  # @see https://github.com/kern/minitest-reporters/blob/master/lib/minitest/reporters/spec_reporter.rb SpecReporter
23
24
  # @see https://github.com/TwP/turn turn
24
25
  class TurnAgainReporter < BaseReporter
26
+ require 'ansi'
25
27
  include ANSI::Code
26
28
  include RelativePosition
27
29
 
@@ -0,0 +1,14 @@
1
+ require 'test_helper'
2
+
3
+ class ErrorFormatTest < Minitest::Test
4
+
5
+ def test_failure_in_assert
6
+ assert(true * 5)
7
+ end
8
+
9
+ def test_failure_before_assert
10
+ result = Object.new.nonexistentmethod
11
+ refute(result)
12
+ end
13
+
14
+ end
@@ -0,0 +1,13 @@
1
+ require 'test_helper'
2
+
3
+ class FailFormatTest < Minitest::Test
4
+
5
+ def test_failing_the_truth
6
+ refute(true)
7
+ end
8
+
9
+ def test_failure_of_denial
10
+ assert(false)
11
+ end
12
+
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'test_helper'
2
+
3
+ class PassFormatTest < Minitest::Test
4
+
5
+ def test_the_truth
6
+ assert(true)
7
+ end
8
+
9
+ def test_denial
10
+ refute(false)
11
+ end
12
+
13
+ end
@@ -0,0 +1,14 @@
1
+ require 'test_helper'
2
+
3
+ class SkipFormatTest < Minitest::Test
4
+
5
+ def test_skip_one
6
+ skip
7
+ end
8
+
9
+ def test_skip_two
10
+ assert(true)
11
+ skip
12
+ end
13
+
14
+ end
@@ -0,0 +1,7 @@
1
+ require 'bundler/setup'
2
+ require 'minitest'
3
+ require 'minitest/autorun'
4
+ require 'minitest/reporters'
5
+ require 'minitest/reporters/turn_again_reporter'
6
+
7
+ Minitest::Reporters.use!(Minitest::Reporters::TurnAgainReporter.new)
@@ -1,7 +1,8 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'minitest/reporters/turn_again_reporter'
4
+
5
+ require 'minitest/reporters/turn_again_reporter/version'
5
6
 
6
7
  Gem::Specification.new do |spec|
7
8
  spec.name = "turn-again-reporter"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turn-again-reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Kwiatkowski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-01 00:00:00.000000000 Z
11
+ date: 2016-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -76,6 +76,11 @@ files:
76
76
  - Rakefile
77
77
  - lib/minitest/reporters/turn_again_reporter.rb
78
78
  - lib/minitest/reporters/turn_again_reporter/version.rb
79
+ - test/integration/error_format_test.rb
80
+ - test/integration/fail_format_test.rb
81
+ - test/integration/pass_format_test.rb
82
+ - test/integration/skip_format_test.rb
83
+ - test/test_helper.rb
79
84
  - turn-again-reporter.gemspec
80
85
  homepage: https://github.com/swifthand/turn-again-reporter
81
86
  licenses:
@@ -97,9 +102,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
102
  version: '0'
98
103
  requirements: []
99
104
  rubyforge_project:
100
- rubygems_version: 2.4.4
105
+ rubygems_version: 2.4.8
101
106
  signing_key:
102
107
  specification_version: 4
103
108
  summary: A reporter for the minitest-reporters gem that more accurately mimics the
104
109
  behavior of the turn gem.
105
- test_files: []
110
+ test_files:
111
+ - test/integration/error_format_test.rb
112
+ - test/integration/fail_format_test.rb
113
+ - test/integration/pass_format_test.rb
114
+ - test/integration/skip_format_test.rb
115
+ - test/test_helper.rb