minitest-slow_test 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +6 -0
- data/lib/minitest/slow_test/reporter.rb +3 -1
- data/lib/minitest/slow_test/version.rb +1 -1
- data/lib/minitest/slow_test.rb +8 -0
- data/test/slow_test_test.rb +14 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10c13a57823cc69a5f0bfb262dcfb3c7b6b6f817
|
4
|
+
data.tar.gz: a2df404cc613cb6091a0c02507e8b90a40b8af49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79c136e7fec5fdb7bd815fa3358531deae13fc391232f2bf297c158594cd6c3033acfb23e5b587fa3807a288aeaf3a3a0a907153371aa734f54ac61b64899a7d
|
7
|
+
data.tar.gz: 0dd5b1956e62c683adc55f44df3b738681d825df3a40d468c6adceb9574618a35cd458677a74cc1cae702a8a391d4faef072a404783bbc3b28f660ad7eac598a
|
data/CHANGELOG.md
ADDED
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
|
-
|
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`,
|
data/lib/minitest/slow_test.rb
CHANGED
@@ -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
|
data/test/slow_test_test.rb
CHANGED
@@ -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
|
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-
|
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
|