minitest-line 0.6.1 → 0.6.2
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 +4 -4
- data/lib/minitest/line_plugin.rb +6 -1
- metadata +6 -7
- data/test/test_line.rb +0 -67
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5ce066391b220600b0c1866d5000050bd9aeaa9
|
4
|
+
data.tar.gz: ac7e7ae85bbb0d820b6a4be83c0b7039ff56e284
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b58cd597e96cc4f0f1d40fdaab8e0007c178161987355ba212a985efd39750d3148b44ebe4536dd5de257f76f428ef80c679957668c365e499bfdcb24303a801
|
7
|
+
data.tar.gz: b3bef54a0ae8f41e2efe1cfcdfe19d9deeccc0b8aaf7cc677f0c9cc64478cea00477b90b3a1032dea039710915656994938987173d701012da153ac724ca3c9c
|
data/lib/minitest/line_plugin.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
1
3
|
module Minitest
|
2
4
|
def self.plugin_line_options(opts, options)
|
3
5
|
opts.on '-l', '--line N', Integer, "Run test at line number" do |lineno|
|
@@ -53,11 +55,14 @@ module Minitest
|
|
53
55
|
return unless @failures.any?
|
54
56
|
io.puts
|
55
57
|
io.puts "Focus on failing tests:"
|
58
|
+
pwd = Pathname.new(Dir.pwd)
|
56
59
|
@failures.each do |res|
|
57
60
|
meth = res.method(res.name)
|
58
61
|
file, line = meth.source_location
|
59
62
|
if file
|
60
|
-
|
63
|
+
file = Pathname.new(file)
|
64
|
+
file = file.relative_path_from(pwd) if file.absolute?
|
65
|
+
io.puts "ruby #{file} -l #{line}"
|
61
66
|
end
|
62
67
|
end
|
63
68
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-line
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Magnus Holm
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -31,9 +31,9 @@ extensions: []
|
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
33
|
- lib/minitest/line_plugin.rb
|
34
|
-
- test/test_line.rb
|
35
34
|
homepage: https://github.com/judofyr/minitest-line
|
36
|
-
licenses:
|
35
|
+
licenses:
|
36
|
+
- MIT
|
37
37
|
metadata: {}
|
38
38
|
post_install_message:
|
39
39
|
rdoc_options: []
|
@@ -51,10 +51,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
51
|
version: '0'
|
52
52
|
requirements: []
|
53
53
|
rubyforge_project:
|
54
|
-
rubygems_version: 2.2.
|
54
|
+
rubygems_version: 2.2.2
|
55
55
|
signing_key:
|
56
56
|
specification_version: 4
|
57
57
|
summary: Focused tests for Minitest
|
58
|
-
test_files:
|
59
|
-
- test/test_line.rb
|
58
|
+
test_files: []
|
60
59
|
has_rdoc:
|
data/test/test_line.rb
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
$LOAD_PATH << File.expand_path('../../lib', __FILE__)
|
2
|
-
|
3
|
-
require 'stringio'
|
4
|
-
require 'minitest'
|
5
|
-
require 'minitest/autorun'
|
6
|
-
require 'minitest/mock'
|
7
|
-
|
8
|
-
class LineExample < Minitest::Test
|
9
|
-
def test_hello
|
10
|
-
p :hello
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_world
|
14
|
-
p :world
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_failure
|
18
|
-
flunk
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_skip
|
22
|
-
skip
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
Minitest::Runnable.runnables.delete(LineExample)
|
27
|
-
|
28
|
-
class TestLine < Minitest::Test
|
29
|
-
def run_class(klass, args = [])
|
30
|
-
Minitest::Runnable.stub :runnables, [klass] do
|
31
|
-
$stdout = io = StringIO.new
|
32
|
-
Minitest.run(args)
|
33
|
-
$stdout = STDOUT
|
34
|
-
io.string
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_line
|
39
|
-
(9..12).each do |line|
|
40
|
-
output = run_class LineExample, ['--line', line.to_s]
|
41
|
-
assert_match /1 runs/, output
|
42
|
-
assert_match /:hello/, output
|
43
|
-
refute_match /:world/, output
|
44
|
-
end
|
45
|
-
|
46
|
-
(13..16).each do |line|
|
47
|
-
output = run_class LineExample, ['--line', line.to_s]
|
48
|
-
assert_match /1 runs/, output
|
49
|
-
assert_match /:world/, output
|
50
|
-
refute_match /:hello/, output
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_show_focus
|
55
|
-
output = run_class LineExample
|
56
|
-
assert_match /Focus on failing tests:/, output
|
57
|
-
assert_match /#{__FILE__} -l 17/, output
|
58
|
-
refute_match /-l 21/, output
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_before
|
62
|
-
assert_raises(RuntimeError) do
|
63
|
-
run_class LineExample, ['--line', '8']
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|