minitest-line 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 033798121697d4db1518811cbaa39f16506138e9
4
+ data.tar.gz: 85dc3377cbe4c11ac24f93446d8fa7ceb0ede0b5
5
+ SHA512:
6
+ metadata.gz: a26a3653509448ce99fd056be2f7a689f83cc76ae4912857f4bc119bdfda782064846c4a50d0f693a1990655f72547c59ae42f105dfcc2b6fb321aba5ee88fdf
7
+ data.tar.gz: 52f2cb63522584626a41796dfd879dac5a56c0add27e8a80b83afd4397f4d140212261a8c2281da9c9e36c0bc65f3397ba521c9fada3bb7400533a37d92dd252
@@ -6,7 +6,11 @@ module Minitest
6
6
  end
7
7
 
8
8
  def self.plugin_line_init(options)
9
- return unless exp_line = options[:line]
9
+ exp_line = options[:line]
10
+ if !exp_line
11
+ reporter.reporters << LineReporter.new
12
+ return
13
+ end
10
14
 
11
15
  methods = Runnable.runnables.flat_map do |runnable|
12
16
  runnable.runnable_methods.map do |name|
@@ -32,5 +36,34 @@ module Minitest
32
36
 
33
37
  options[:filter] = main_test
34
38
  end
39
+
40
+ class LineReporter < Reporter
41
+ def initialize(*)
42
+ super
43
+ @failures = []
44
+ end
45
+
46
+ def record(result)
47
+ if !result.passed?
48
+ @failures << result
49
+ end
50
+ end
51
+
52
+ def report
53
+ return unless @failures.any?
54
+ io.puts
55
+ io.puts "Focus on failing tests:"
56
+ @failures.each do |res|
57
+ meth = res.method(res.name)
58
+ file, line = meth.source_location
59
+ if file
60
+ io.puts "$ ruby #{file} -l #{line}"
61
+ end
62
+ end
63
+ end
64
+ end
65
+
66
+ def self.plugin_line_inject_reporter
67
+ end
35
68
  end
36
69
 
@@ -13,6 +13,10 @@ class LineExample < Minitest::Test
13
13
  def test_world
14
14
  p :world
15
15
  end
16
+
17
+ def test_failure
18
+ flunk
19
+ end
16
20
  end
17
21
 
18
22
  Minitest::Runnable.runnables.delete(LineExample)
@@ -35,7 +39,7 @@ class TestLine < Minitest::Test
35
39
  refute_match /:world/, output
36
40
  end
37
41
 
38
- (13..45).each do |line|
42
+ (13..16).each do |line|
39
43
  output = run_class LineExample, ['--line', line.to_s]
40
44
  assert_match /1 runs/, output
41
45
  assert_match /:world/, output
@@ -43,6 +47,12 @@ class TestLine < Minitest::Test
43
47
  end
44
48
  end
45
49
 
50
+ def test_show_focus
51
+ output = run_class LineExample
52
+ assert_match /Focus on failing tests:/, output
53
+ assert_match /#{__FILE__} -l 17/, output
54
+ end
55
+
46
56
  def test_before
47
57
  assert_raises(RuntimeError) do
48
58
  run_class LineExample, ['--line', '8']
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-line
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
5
- prerelease:
4
+ version: 0.6.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Magnus Holm
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-26 00:00:00.000000000 Z
11
+ date: 2014-03-25 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: minitest
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '5.0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '5.0'
30
27
  description: Focused tests for Minitest
@@ -33,31 +30,30 @@ executables: []
33
30
  extensions: []
34
31
  extra_rdoc_files: []
35
32
  files:
36
- - test/test_line.rb
37
33
  - lib/minitest/line_plugin.rb
34
+ - test/test_line.rb
38
35
  homepage: https://github.com/judofyr/minitest-line
39
36
  licenses: []
37
+ metadata: {}
40
38
  post_install_message:
41
39
  rdoc_options: []
42
40
  require_paths:
43
41
  - lib
44
42
  required_ruby_version: !ruby/object:Gem::Requirement
45
- none: false
46
43
  requirements:
47
- - - ! '>='
44
+ - - ">="
48
45
  - !ruby/object:Gem::Version
49
46
  version: '0'
50
47
  required_rubygems_version: !ruby/object:Gem::Requirement
51
- none: false
52
48
  requirements:
53
- - - ! '>='
49
+ - - ">="
54
50
  - !ruby/object:Gem::Version
55
51
  version: '0'
56
52
  requirements: []
57
53
  rubyforge_project:
58
- rubygems_version: 1.8.25
54
+ rubygems_version: 2.2.1
59
55
  signing_key:
60
- specification_version: 3
56
+ specification_version: 4
61
57
  summary: Focused tests for Minitest
62
58
  test_files:
63
59
  - test/test_line.rb