pretty_test 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -71,13 +71,13 @@ class MiniTest::Unit
71
71
  report = case error
72
72
  when MiniTest::Skip then
73
73
  @skips += 1
74
- "\e[30m\e[43m[SKIPPED] #{pretty_test_name(klass, method)}\e[0m\n#{pretty_location(error)}\n\e[31m#{error.message}\e[0m"
74
+ "\e[30m\e[43m[SKIPPED] #{pretty_test_name(klass, method)}\e[0m\n#{pretty_skipped_location(error)}\n\e[31m#{error.message}\e[0m"
75
75
  when MiniTest::Assertion then
76
76
  @failures += 1
77
- "\e[37m\e[41m\e[1m[FAILURE] #{pretty_test_name(klass, method)}\e[0m\n#{pretty_location(error)}\n#{error.message}"
77
+ "\e[37m\e[41m\e[1m[FAILURE] #{pretty_test_name(klass, method)}\e[0m\n#{pretty_failure_location(error)}\n#{error.message}"
78
78
  else
79
79
  @errors += 1
80
- "\e[37m\e[41m\e[1m[ERROR] #{pretty_test_name(klass, method)}\e[0m\n#{pretty_trace(error)}"
80
+ "\e[37m\e[41m\e[1m[ERROR] #{pretty_test_name(klass, method)}\e[0m\n#{pretty_error_trace(error)}"
81
81
  end
82
82
  @@out.puts "#{report}\n\n"
83
83
  end
@@ -90,14 +90,23 @@ class MiniTest::Unit
90
90
  "#{suite_name}: #{test_name}"
91
91
  end
92
92
 
93
- def pretty_location(error)
93
+ def pretty_skipped_location(error)
94
94
  location = error.backtrace.detect do |line|
95
95
  line =~ %r{^#{Dir.pwd}/}
96
96
  end
97
97
  clean_trace_line("\e[1m-> ", location)
98
98
  end
99
99
 
100
- def pretty_trace(error)
100
+ def pretty_failure_location(error)
101
+ location = nil
102
+ error.backtrace.reverse.each do |line|
103
+ break if line =~ /in .(assert|refute)_/
104
+ location = line if line =~ %r{^#{Dir.pwd}/}
105
+ end
106
+ clean_trace_line("\e[1m-> ", location)
107
+ end
108
+
109
+ def pretty_error_trace(error)
101
110
  location = error.backtrace.detect do |line|
102
111
  line =~ %r{^#{Dir.pwd}/}
103
112
  end
@@ -1,3 +1,3 @@
1
1
  module PrettyTest
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/pretty_test.gemspec CHANGED
@@ -5,8 +5,8 @@ Gem::Specification.new do |gem|
5
5
  gem.authors = ["Vladimir Bobes Tuzinsky"]
6
6
  gem.email = ["vladimir@tuzinsky.com"]
7
7
  gem.summary = %q{Minitest patch for pretty output}
8
- gem.description = %q{Minitest patch for pretty output.}
9
- gem.homepage = "http://github.com/bobes/pretty_test"
8
+ gem.description = %q{Minitest patch for pretty (and useful) output.}
9
+ gem.homepage = "https://github.com/bobes/pretty_test"
10
10
 
11
11
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
12
  gem.files = `git ls-files`.split("\n")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pretty_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,9 +9,9 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-08 00:00:00.000000000Z
12
+ date: 2011-10-10 00:00:00.000000000Z
13
13
  dependencies: []
14
- description: Minitest patch for pretty output.
14
+ description: Minitest patch for pretty (and useful) output.
15
15
  email:
16
16
  - vladimir@tuzinsky.com
17
17
  executables: []
@@ -24,7 +24,7 @@ files:
24
24
  - lib/pretty_test/mini_test.rb
25
25
  - lib/pretty_test/version.rb
26
26
  - pretty_test.gemspec
27
- homepage: http://github.com/bobes/pretty_test
27
+ homepage: https://github.com/bobes/pretty_test
28
28
  licenses: []
29
29
  post_install_message:
30
30
  rdoc_options: []