minitest-display 0.3.0 → 0.3.1

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: 48d4d55407451f1f672008f5b08e08b2e5a8b53b
4
- data.tar.gz: 7a6638224049a9703ce2f45320519e1248e4d385
3
+ metadata.gz: 1af0f8833154cb3813a6b1b3e3d50a0089cfb35f
4
+ data.tar.gz: 64f35a6137223c2a7da691191c7939fef9826ac3
5
5
  SHA512:
6
- metadata.gz: 191907f4d3ee47711de8621952f5e57329295023c2b388c0251bd18f9bb8002842c1773ef3d54ee474858227c9ab7c3c7d620a5bc3e94b7e9418f44c16086eb5
7
- data.tar.gz: 86ca36a210cc82ce1e0353458159540e1f81884566b0ae0924352c0a2f8a982258698aa5f8801b4aaae13db51a2b3b70f69281e015d56249772bdc10cd026c47
6
+ metadata.gz: 1847aace5255c0e59619913feb9e7dff7c0f7ecb7a26be4bb4e4e569470e196520e9b0e82e79a6298c772060dd9133c7557e6189f6f0128b85b52f265000101d
7
+ data.tar.gz: 69903f9d36ef6ec21d07f7a26da9d97cfa3f4bb8e014229435711a7a9a047e7028b6bd7125461b214cacac48b1be833367b7569a1ae07341801ec92501547417
@@ -1,4 +1,4 @@
1
- require 'minitest'
1
+ require 'minitest'
2
2
 
3
3
  class Hash
4
4
  unless method_defined?(:deep_merge!)
@@ -20,7 +20,7 @@ end
20
20
 
21
21
  module Minitest
22
22
  module Display
23
- VERSION = '0.3.0'
23
+ VERSION = '0.3.1'
24
24
 
25
25
  class << self
26
26
  def options
@@ -113,7 +113,7 @@ module Minitest
113
113
  def printable_suite?(suite)
114
114
  !DONT_PRINT_CLASSES.include?(suite.to_s)
115
115
  end
116
-
116
+
117
117
  # Add a recorder which for each test that has a `record`.
118
118
  # Optionally can also have an:
119
119
  #
@@ -162,7 +162,7 @@ module Minitest
162
162
  @suite_finished = Time.now
163
163
  time = @suite_finished.to_f - @suite_started.to_f
164
164
  print "\n#{' ' * @suite_header.length}#{display.options[:suite_divider]}"
165
- print "%.2f s" % time
165
+ print "%.2f s" % time
166
166
  run_recorder_method(:record_suite_finished, suite, @assertions, time)
167
167
  end
168
168
 
@@ -174,7 +174,7 @@ module Minitest
174
174
 
175
175
  def report
176
176
  record_suite_finished(@current_suite) if @current_suite
177
- puts
177
+ puts
178
178
  display_slow_tests if display.options[:output_slow]
179
179
  display_slow_suites if display.options[:output_slow_suites]
180
180
  run_recorder_method(:record_tests_finished, @total_tests, @total_assertions, @total_failures, @total_errors, Time.now.to_f - @tests_started)
@@ -187,7 +187,7 @@ module Minitest
187
187
  record_suite_started(suite)
188
188
  @assertions = 0
189
189
  end
190
- @assertions += result.assertions
190
+ @assertions += result.assertions
191
191
  @total_assertions += result.assertions
192
192
  @total_tests += 1
193
193
  output = if result.error?
@@ -217,7 +217,7 @@ module Minitest
217
217
  times = @test_times.values.flatten(1).sort { |a, b| b[1] <=> a[1] }
218
218
  puts "Slowest tests:"
219
219
  times[0..display.options[:output_slow].to_i].each do |test_name, time|
220
- puts "%.2f s\t#{test_name}" % time
220
+ puts "%.2f s\t#{test_name.gsub(/%/, '%%')}" % time
221
221
  end
222
222
  end
223
223
 
@@ -225,7 +225,7 @@ module Minitest
225
225
  times = @test_times.map { |suite, tests| [suite, tests.map(&:last).inject {|sum, n| sum + n }] }.sort { |a, b| b[1] <=> a[1] }
226
226
  puts "Slowest suites:"
227
227
  times[0..display.options[:output_slow_suites].to_i].each do |suite, time|
228
- puts "%.2f s\t#{suite}" % time
228
+ puts "%.2f s\t#{suite.name.gsub(/%/, '%%')}" % time
229
229
  end
230
230
  end
231
231
 
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: minitest-display 0.3.0 ruby lib
5
+ # stub: minitest-display 0.3.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "minitest-display"
9
- s.version = "0.3.0"
9
+ s.version = "0.3.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Aaron Quint"]
14
- s.date = "2014-12-22"
14
+ s.date = "2015-03-31"
15
15
  s.description = "Patches MiniTest to allow for an easily configurable output. For Ruby 1.9 :Datches MiniTest to allow for an easily configurable output. For Ruby 1.9 :D. Inspired by leftright, redgreen and other test output gems, with an emphasis on configuration and style"
16
16
  s.email = "aaron@quirkey.com"
17
17
  s.extra_rdoc_files = [
@@ -1,16 +1,17 @@
1
1
  require 'helper'
2
+ require 'minitest/spec'
2
3
 
3
4
  class TestMinitestDisplay < MiniTest::Test
4
5
 
5
6
  def test_runs_basic_test_with_default_settings
6
7
  capture_test_output <<-TESTCASE
7
- class BasicTest < Minitest::Test
8
+ describe "BasicTest" do
8
9
 
9
- def test_truth
10
+ it "asserts truth" do
10
11
  assert true
11
12
  end
12
13
 
13
- def test_equality
14
+ it "asserts equality" do
14
15
  assert_equal 'test', 'test'
15
16
  end
16
17
  end
@@ -22,13 +23,13 @@ class TestMinitestDisplay < MiniTest::Test
22
23
 
23
24
  def test_runs_basic_test_with_failures
24
25
  capture_test_output <<-TESTCASE
25
- class BasicTest < Minitest::Test
26
+ describe "BasicTest" do
26
27
 
27
- def test_truth
28
+ it "fails when asserting false" do
28
29
  assert false
29
30
  end
30
31
 
31
- def test_equality
32
+ it "asserts equality" do
32
33
  assert_equal 'test', 'test'
33
34
  end
34
35
  end
@@ -41,24 +42,25 @@ class TestMinitestDisplay < MiniTest::Test
41
42
 
42
43
  def test_runs_basic_test_with_multiple_suites
43
44
  capture_test_output <<-TESTCASE
44
- class BasicTest < Minitest::Test
45
45
 
46
- def test_truth
46
+ describe "BasicTest" do
47
+
48
+ it "fails when asserting false" do
47
49
  assert false
48
50
  end
49
51
 
50
- def test_equality
52
+ it "asserts equality" do
51
53
  assert_equal 'test', 'test'
52
54
  end
53
55
  end
54
56
 
55
- class AnotherBasicTest < Minitest::Test
57
+ describe "AnotherBasicTest" do
56
58
 
57
- def test_truth
59
+ it "fails when asserting false" do
58
60
  assert false
59
61
  end
60
62
 
61
- def test_equality
63
+ it "asserts equality" do
62
64
  assert_equal 'test', 'test'
63
65
  end
64
66
  end
@@ -78,13 +80,14 @@ class TestMinitestDisplay < MiniTest::Test
78
80
  :success => 'PASS'
79
81
  }
80
82
  }
81
- class PrintTest < Minitest::Test
82
83
 
83
- def test_truth
84
+ describe "PrintTest" do
85
+
86
+ it "fails when asserting false" do
84
87
  assert false
85
88
  end
86
89
 
87
- def test_equality
90
+ it "asserts equality" do
88
91
  assert_equal 'test', 'test'
89
92
  end
90
93
  end
@@ -104,13 +107,14 @@ class TestMinitestDisplay < MiniTest::Test
104
107
  },
105
108
  :output_slow => true
106
109
  }
107
- class PrintTest < Minitest::Test
108
110
 
109
- def test_truth
111
+ describe "PrintTest" do
112
+
113
+ it "fails when asserting false" do
110
114
  assert false
111
115
  end
112
116
 
113
- def test_equality
117
+ it "asserts equality" do
114
118
  assert_equal 'test', 'test'
115
119
  end
116
120
  end
@@ -122,6 +126,32 @@ class TestMinitestDisplay < MiniTest::Test
122
126
  assert_output(/Slowest tests:/)
123
127
  end
124
128
 
129
+ def test_runs_basic_test_suite_with_slow_output_and_percent_sign
130
+ capture_test_output <<-TESTCASE
131
+ MiniTest::Display.options = {
132
+ :suite_divider => ' // ',
133
+ :print => {
134
+ :success => 'PASS'
135
+ }
136
+ }
137
+ describe "Print%Test" do
138
+
139
+ it "fails when asserting false" do
140
+ assert false
141
+ end
142
+
143
+ it "accepts tests with a % sign in the name" do
144
+ assert_equal "0%", "0%"
145
+ end
146
+ end
147
+ TESTCASE
148
+
149
+ assert_output(/Print%Test \/\//)
150
+ assert_output(/F/)
151
+ assert_output(/PASS/)
152
+ assert_output(/Slowest tests:/)
153
+ end
154
+
125
155
  def test_adding_a_recorder
126
156
  capture_test_output <<-TESTCASE
127
157
  MiniTest::Display.options = {
@@ -142,13 +172,13 @@ class TestMinitestDisplay < MiniTest::Test
142
172
 
143
173
  MiniTest::Display.add_recorder TestRecorder
144
174
 
145
- class PrintTest < Minitest::Test
175
+ describe "PrintTest" do
146
176
 
147
- def test_truth
177
+ it "fails when asserting false" do
148
178
  assert false
149
179
  end
150
180
 
151
- def test_equality
181
+ it "asserts equality" do
152
182
  assert_equal 'test', 'test'
153
183
  end
154
184
  end
@@ -157,6 +187,6 @@ class TestMinitestDisplay < MiniTest::Test
157
187
  assert_output(/PrintTest \/\//)
158
188
  assert_output(/F/)
159
189
  assert_output(/PASS/)
160
- assert_output(/I just recorded test_truth/)
190
+ assert_output(/I just recorded.*fails when asserting false/)
161
191
  end
162
192
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-display
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Quint
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-22 00:00:00.000000000 Z
11
+ date: 2015-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest