minitest-example 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/minitest/example.rb +47 -17
- data/minitest-example.gemspec +1 -1
- metadata +2 -3
- data/Gemfile.lock +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 368624d0592e344cd48707c0d0103f09b8d46b6ba5d59b60b247db1554df2a9a
|
4
|
+
data.tar.gz: 57fb3b6d0bff1c1e2c496be03c3ce0955798458ee96a15e6f61f4569646fed01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62c40e7f453625633ad158cd744e0c5167b1ad072f986a36b04241b386681895934ba2d149d483840d1abc7b86e00513fb4d28761a6e4594088b1137c0594aab
|
7
|
+
data.tar.gz: 3f4d5c41cfdc473de031dcfacd705b9fa90c78f8ba284a433a2c0c6505c742968a4c6a89d1e9f17dd2e56aec6d969295ad1bd5f37f232c72fe9af96f3680abd4
|
data/.gitignore
CHANGED
data/lib/minitest/example.rb
CHANGED
@@ -8,28 +8,58 @@ module Minitest
|
|
8
8
|
def runnable_methods
|
9
9
|
methods_matching(/^example_/)
|
10
10
|
end
|
11
|
+
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
def run
|
14
|
+
code = self.class.instance_method(self.name).source
|
15
|
+
parser = Rgot::ExampleParser.new(code)
|
16
|
+
parser.parse
|
17
|
+
example = parser.examples.first
|
17
18
|
|
18
|
-
|
19
|
-
|
19
|
+
with_info_handler do
|
20
|
+
time_it do
|
21
|
+
capture_exceptions do
|
22
|
+
before_setup; setup; after_setup
|
20
23
|
|
21
|
-
|
22
|
-
|
24
|
+
out = capture_stdout do
|
25
|
+
self.send self.name
|
26
|
+
end
|
27
|
+
|
28
|
+
assert_equal example.output.strip, out.strip
|
29
|
+
end
|
23
30
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
ensure
|
31
|
-
$stdout = original_out
|
31
|
+
TEARDOWN_METHODS.each do |hook|
|
32
|
+
capture_exceptions do
|
33
|
+
self.send hook
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
32
37
|
end
|
38
|
+
|
39
|
+
result = ExampleResult.from self # per contract
|
40
|
+
result.source_location = self.method(self.name).source_location
|
41
|
+
result
|
42
|
+
end
|
43
|
+
|
44
|
+
def capture_stdout
|
45
|
+
original_out = $stdout
|
46
|
+
out = StringIO.new
|
47
|
+
$stdout = out
|
48
|
+
yield
|
49
|
+
out.string
|
50
|
+
ensure
|
51
|
+
$stdout = original_out
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
class ExampleResult < Minitest::Result
|
56
|
+
def self.runnable_methods
|
57
|
+
[]
|
58
|
+
end
|
59
|
+
|
60
|
+
def location
|
61
|
+
loc = " [#{source_location[0]}:#{source_location[1]}]" unless passed? or error?
|
62
|
+
"#{self.class_name}##{self.name}#{loc}"
|
33
63
|
end
|
34
64
|
end
|
35
65
|
end
|
data/minitest-example.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-example
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuji Yaginuma
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rgot
|
@@ -105,7 +105,6 @@ files:
|
|
105
105
|
- ".travis.yml"
|
106
106
|
- CODE_OF_CONDUCT.md
|
107
107
|
- Gemfile
|
108
|
-
- Gemfile.lock
|
109
108
|
- LICENSE.txt
|
110
109
|
- README.md
|
111
110
|
- Rakefile
|
data/Gemfile.lock
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
minitest-example (0.0.1)
|
5
|
-
method_source
|
6
|
-
rgot
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
byebug (10.0.2)
|
12
|
-
method_source (0.9.0)
|
13
|
-
minitest (5.11.3)
|
14
|
-
rake (10.5.0)
|
15
|
-
rgot (0.2.0)
|
16
|
-
|
17
|
-
PLATFORMS
|
18
|
-
ruby
|
19
|
-
|
20
|
-
DEPENDENCIES
|
21
|
-
bundler (~> 1.16)
|
22
|
-
byebug
|
23
|
-
minitest (~> 5.0)
|
24
|
-
minitest-example!
|
25
|
-
rake (~> 10.0)
|
26
|
-
|
27
|
-
BUNDLED WITH
|
28
|
-
1.16.2
|