minitest-slow_test 0.0.2 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c237cbe6ac0d74f3ae7662ed04f5ce40baf182d9
4
- data.tar.gz: 9e3e4f94b1cb72b3a67aae89958e0f83d81af13c
3
+ metadata.gz: 10c13a57823cc69a5f0bfb262dcfb3c7b6b6f817
4
+ data.tar.gz: a2df404cc613cb6091a0c02507e8b90a40b8af49
5
5
  SHA512:
6
- metadata.gz: 041f14d896589969a210731e84b5d4673b62ffece5b03cf2de52beca995ba6afe199863e97dacc8eb75a3f2fadd19af89f6eec8a39236115287fe50c647a0fdc
7
- data.tar.gz: 2a7b048a8e9908d81df39bf72bd67f9a3ca400f482595344dc8afde83c8bc6b6391a8e2093f435b98009c1c575e7cf0c8eb90f691a3e7a6c08b26d7febcc4716
6
+ metadata.gz: 79c136e7fec5fdb7bd815fa3358531deae13fc391232f2bf297c158594cd6c3033acfb23e5b587fa3807a288aeaf3a3a0a907153371aa734f54ac61b64899a7d
7
+ data.tar.gz: 0dd5b1956e62c683adc55f44df3b738681d825df3a40d468c6adceb9574618a35cd458677a74cc1cae702a8a391d4faef072a404783bbc3b28f660ad7eac598a
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## 0.2.0
2
+
3
+ * Add `exclude_test_name` option
data/README.md CHANGED
@@ -49,6 +49,12 @@ require 'minitest/slow_test'
49
49
  Minitest::SlowTest.long_test_time = 0.5 # specified in seconds
50
50
  ```
51
51
 
52
+ If there is a test that you do not want to display even if slow, use the `exclude` options.
53
+
54
+ ```ruby
55
+ Minitest::SlowTest.exclude_test_name = %(test_do_not_display) # specify the test name in the Array of String
56
+ ```
57
+
52
58
  ### When use with `minitest-reporters`
53
59
 
54
60
  When use it with `minitest-reporters`, it is necessary to set `Minitest::SlowTest::Reporter` in `Minitest::Reporters.use!`
@@ -16,7 +16,9 @@ module Minitest
16
16
  end
17
17
 
18
18
  def record(result)
19
- @slow_test_list << result if result.time.to_f > SlowTest.long_test_time
19
+ if result.time.to_f > SlowTest.long_test_time && !SlowTest.exclude_test_name.include?(result.name.to_s)
20
+ @slow_test_list << result
21
+ end
20
22
  end
21
23
 
22
24
  # When using the following methods together with `minitest-reporters`,
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module SlowTest
3
- VERSION = "0.0.2"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -4,6 +4,7 @@ module Minitest
4
4
  module SlowTest
5
5
  class << self
6
6
  attr_writer :long_test_time
7
+ attr_writer :exclude_test_name
7
8
 
8
9
  def long_test_time
9
10
  unless defined? @long_test_time
@@ -11,6 +12,13 @@ module Minitest
11
12
  end
12
13
  @long_test_time.to_f
13
14
  end
15
+
16
+ def exclude_test_name
17
+ unless defined? @exclude_test_name
18
+ @exclude_test_name = []
19
+ end
20
+ @exclude_test_name
21
+ end
14
22
  end
15
23
  end
16
24
  end
@@ -23,6 +23,16 @@ module MinitestSlowTestTest
23
23
  reporter.report
24
24
  assert_match /\[SlowTest\] SampleTest#test_slow/, @output.string
25
25
  end
26
+
27
+ def test_exclude_test_information_do_not_display
28
+ Minitest::SlowTest.exclude_test_name = %(test_more_slow)
29
+ reporter.start
30
+ reporter.record(SampleTest.new(:test_slow).run)
31
+ reporter.record(SampleTest.new(:test_more_slow).run)
32
+ reporter.report
33
+ assert_match /\[SlowTest\] SampleTest#test_slow/, @output.string
34
+ refute_match /\[SlowTest\] SampleTest#test_more_slow/, @output.string
35
+ end
26
36
  end
27
37
  end
28
38
 
@@ -33,5 +43,9 @@ class SampleTest < Minitest::Test
33
43
  def test_slow
34
44
  sleep 1.0
35
45
  end
46
+
47
+ def test_more_slow
48
+ sleep 1.5
49
+ end
36
50
  end
37
51
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-slow_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Yaginuma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-19 00:00:00.000000000 Z
11
+ date: 2015-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -75,6 +75,7 @@ extra_rdoc_files: []
75
75
  files:
76
76
  - ".gitignore"
77
77
  - ".travis.yml"
78
+ - CHANGELOG.md
78
79
  - Gemfile
79
80
  - LICENSE.txt
80
81
  - README.md