minitest-utils 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a3d7eacdc6f99419e24d644628d2ce2bd8b034b5
4
- data.tar.gz: c2640e2eaf4dad798ad8ce8f329214ced19cf523
3
+ metadata.gz: 03a93deeaff791c6e0c463f3900a5ef73b2e9818
4
+ data.tar.gz: 65399906d8d423813fd89de0a92f3f092761c75d
5
5
  SHA512:
6
- metadata.gz: 7fb4411e84f444f31511a7a5be6329c3c2d6433cc763bedcf40250c0c66fc96ba9fecb338fec078127d5ec2644645e9e6752967eb0b60135c08d1e2bb703a41e
7
- data.tar.gz: 05e09091d4f8826a3d193c651f1be8b9cbc03c5860cac8324a1b2311c9ec6ae224e71b27ff67a6372cf1fad9b0ab8f28479a0ebe4bc97597f45d373d37f96121
6
+ metadata.gz: c372c13681dd4f4d9a371affa37fe1f67b8459de91a26b244c3efc32e480f5fdc30e7beca387eaab88be22b4f0ad8d9454c572320e326f4a87cfbd4c62773002
7
+ data.tar.gz: b0669b26b8d42dc24728d9a7f802782c8ce90e40ebd9cb5f6d33e2b3e2258101e7424761e5adaeff7d501a04e6d85bb9e455b159fd0427961fd601b5392838a2
@@ -94,6 +94,8 @@ module Minitest
94
94
 
95
95
  def display_replay_command(result)
96
96
  location = find_test_file(result)
97
+ return if location.empty?
98
+
97
99
  command = %[rake TEST=#{location} TESTOPTS="--name=#{result.name}"]
98
100
  str = "\n"
99
101
  str << color(command, :red)
@@ -104,17 +106,19 @@ module Minitest
104
106
  def find_test_file(result)
105
107
  filter_backtrace(result.failure.backtrace)
106
108
  .find {|line| line.match(%r((test|spec)/.*?_(test|spec).rb)) }
109
+ .to_s
107
110
  .gsub(/:\d+.*?$/, '')
108
111
  end
109
112
 
110
113
  def backtrace(backtrace)
111
- backtrace = filter_backtrace(backtrace).map {|line| location(line) }
114
+ backtrace = filter_backtrace(backtrace).map {|line| location(line, true) }
112
115
  return if backtrace.empty?
113
116
  indent(backtrace.join("\n")).gsub(/^(\s+)/, "\\1# ")
114
117
  end
115
118
 
116
- def location(location)
117
- location = File.expand_path(location[/^([^:]+)/, 1])
119
+ def location(location, include_line_number = false)
120
+ regex = include_line_number ? /^([^:]+:\d+)/ : /^([^:]+)/
121
+ location = File.expand_path(location[regex, 1])
118
122
 
119
123
  return location unless location.start_with?(Dir.pwd)
120
124
 
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module Utils
3
- VERSION = '0.1.3'
3
+ VERSION = '0.1.4'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-05-14 00:00:00.000000000 Z
11
+ date: 2015-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest