justified 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/justified.rb +4 -0
- data/spec/justified.rb +4 -4
- metadata +1 -1
data/lib/justified.rb
CHANGED
@@ -2,6 +2,10 @@ module Justified
|
|
2
2
|
SKIP_STR = ' ... skipped %s lines'
|
3
3
|
CAUSED_STR = 'caused by:'
|
4
4
|
|
5
|
+
def self.version
|
6
|
+
@version ||= Gem::Version.new File.read(File.join(File.dirname(__FILE__), '..', 'VERSION'))
|
7
|
+
end
|
8
|
+
|
5
9
|
module Error
|
6
10
|
def initialize(message = nil, cause = $!)
|
7
11
|
super(message)
|
data/spec/justified.rb
CHANGED
@@ -37,7 +37,7 @@ describe 'justified' do
|
|
37
37
|
it { error.cause.message.must_equal 'bad' }
|
38
38
|
it { error.backtrace.must_include 'caused by: (AnError) bad' }
|
39
39
|
it do
|
40
|
-
assert error.backtrace.any? { |l| l =~ %r"
|
40
|
+
assert error.backtrace.any? { |l| l =~ %r"spec/justified\.rb:\d+:in `bad_code'" }
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -51,7 +51,7 @@ describe 'justified' do
|
|
51
51
|
it { error2.backtrace.wont_include 'caused by: (AnError) bad' }
|
52
52
|
it do
|
53
53
|
refute error2.backtrace.
|
54
|
-
any? { |l| l =~ %r"
|
54
|
+
any? { |l| l =~ %r"spec/justified\.rb:15:in `bad_code'" }
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -66,7 +66,7 @@ describe 'justified' do
|
|
66
66
|
it { error2.backtrace.must_include 'caused by: (RuntimeError) other' }
|
67
67
|
it do
|
68
68
|
assert error2.backtrace.any? do |l|
|
69
|
-
l =~ %r"
|
69
|
+
l =~ %r"spec/justified\.rb:\d+:in `block \(\d levels\)'"
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
@@ -84,7 +84,7 @@ describe 'justified' do
|
|
84
84
|
it { error.backtrace.must_include 'caused by: (RuntimeError) other' }
|
85
85
|
it do
|
86
86
|
assert error.backtrace.any? do |l|
|
87
|
-
l =~ %r"
|
87
|
+
l =~ %r"spec/justified\.rb:\d+:in `block \(\d levels\)'"
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|