assert 2.19.1 → 2.19.6
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/assert.gemspec +10 -7
- data/lib/assert.rb +18 -6
- data/lib/assert/actual_value.rb +8 -6
- data/lib/assert/assert_runner.rb +36 -17
- data/lib/assert/assertions.rb +83 -50
- data/lib/assert/cli.rb +30 -70
- data/lib/assert/clirb.rb +55 -0
- data/lib/assert/config.rb +20 -8
- data/lib/assert/config_helpers.rb +55 -22
- data/lib/assert/context.rb +14 -18
- data/lib/assert/context/let_dsl.rb +5 -2
- data/lib/assert/context/setup_dsl.rb +21 -16
- data/lib/assert/context/subject_dsl.rb +6 -7
- data/lib/assert/context/suite_dsl.rb +2 -1
- data/lib/assert/context/test_dsl.rb +55 -19
- data/lib/assert/default_suite.rb +25 -15
- data/lib/assert/default_view.rb +47 -30
- data/lib/assert/file_line.rb +6 -6
- data/lib/assert/macro.rb +1 -1
- data/lib/assert/macros/methods.rb +71 -45
- data/lib/assert/result.rb +111 -62
- data/lib/assert/runner.rb +68 -51
- data/lib/assert/stub.rb +42 -3
- data/lib/assert/suite.rb +67 -28
- data/lib/assert/test.rb +40 -35
- data/lib/assert/utils.rb +19 -10
- data/lib/assert/version.rb +1 -1
- data/lib/assert/view.rb +44 -18
- data/lib/assert/view_helpers.rb +100 -92
- data/test/helper.rb +3 -1
- data/test/support/factory.rb +38 -21
- data/test/system/stub_tests.rb +180 -144
- data/test/system/test_tests.rb +86 -60
- data/test/unit/actual_value_tests.rb +69 -50
- data/test/unit/assert_tests.rb +39 -22
- data/test/unit/assertions/assert_block_tests.rb +10 -10
- data/test/unit/assertions/assert_changes_tests.rb +25 -21
- data/test/unit/assertions/assert_empty_tests.rb +14 -12
- data/test/unit/assertions/assert_equal_tests.rb +26 -26
- data/test/unit/assertions/assert_file_exists_tests.rb +15 -13
- data/test/unit/assertions/assert_includes_tests.rb +10 -10
- data/test/unit/assertions/assert_instance_of_tests.rb +14 -14
- data/test/unit/assertions/assert_is_a_tests.rb +128 -0
- data/test/unit/assertions/assert_match_tests.rb +10 -10
- data/test/unit/assertions/assert_nil_tests.rb +16 -12
- data/test/unit/assertions/assert_raises_tests.rb +27 -20
- data/test/unit/assertions/assert_respond_to_tests.rb +10 -10
- data/test/unit/assertions/assert_same_tests.rb +24 -24
- data/test/unit/assertions/assert_true_false_tests.rb +32 -24
- data/test/unit/assertions_tests.rb +14 -9
- data/test/unit/config_helpers_tests.rb +15 -10
- data/test/unit/config_tests.rb +34 -9
- data/test/unit/context/setup_dsl_tests.rb +24 -14
- data/test/unit/context/subject_dsl_tests.rb +3 -3
- data/test/unit/context/suite_dsl_tests.rb +4 -4
- data/test/unit/context/test_dsl_tests.rb +37 -17
- data/test/unit/context_info_tests.rb +4 -4
- data/test/unit/context_tests.rb +110 -54
- data/test/unit/default_suite_tests.rb +10 -6
- data/test/unit/factory_tests.rb +2 -2
- data/test/unit/file_line_tests.rb +7 -7
- data/test/unit/macro_tests.rb +11 -11
- data/test/unit/result_tests.rb +47 -41
- data/test/unit/runner_tests.rb +29 -16
- data/test/unit/suite_tests.rb +37 -15
- data/test/unit/test_tests.rb +63 -50
- data/test/unit/utils_tests.rb +48 -35
- data/test/unit/view_helpers_tests.rb +21 -14
- data/test/unit/view_tests.rb +5 -5
- metadata +26 -11
- data/test/unit/assertions/assert_kind_of_tests.rb +0 -68
data/lib/assert/file_line.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module Assert
|
4
4
|
class FileLine
|
5
5
|
def self.parse(file_line_path)
|
6
|
-
|
6
|
+
new(*(file_line_path.to_s.match(/(^[^\:]*)\:*(\d*).*$/) || [])[1..2])
|
7
7
|
end
|
8
8
|
|
9
9
|
attr_reader :file, :line
|
@@ -13,13 +13,13 @@ module Assert
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def to_s
|
16
|
-
"#{
|
16
|
+
"#{file}:#{line}"
|
17
17
|
end
|
18
18
|
|
19
|
-
def ==(
|
20
|
-
if
|
21
|
-
|
22
|
-
|
19
|
+
def ==(other)
|
20
|
+
if other.is_a?(FileLine)
|
21
|
+
file == other.file &&
|
22
|
+
line == other.line
|
23
23
|
else
|
24
24
|
super
|
25
25
|
end
|
data/lib/assert/macro.rb
CHANGED
@@ -10,9 +10,12 @@ module Assert::Macros
|
|
10
10
|
|
11
11
|
module ClassMethods
|
12
12
|
def have_instance_method(*methods)
|
13
|
-
called_from =
|
13
|
+
called_from =
|
14
|
+
(methods.last.is_a?(Array) ? methods.pop : caller_locations).first
|
14
15
|
Assert::Macro.new do
|
15
|
-
methods.each
|
16
|
+
methods.each do |m|
|
17
|
+
_methods_macro_instance_methods << [m, called_from]
|
18
|
+
end
|
16
19
|
_methods_macro_test called_from
|
17
20
|
end
|
18
21
|
end
|
@@ -21,9 +24,12 @@ module Assert::Macros
|
|
21
24
|
alias_method :have_imeths, :have_instance_method
|
22
25
|
|
23
26
|
def not_have_instance_method(*methods)
|
24
|
-
called_from =
|
27
|
+
called_from =
|
28
|
+
(methods.last.is_a?(Array) ? methods.pop : caller_locations).first
|
25
29
|
Assert::Macro.new do
|
26
|
-
methods.each
|
30
|
+
methods.each do |m|
|
31
|
+
_methods_macro_not_instance_methods << [m, called_from]
|
32
|
+
end
|
27
33
|
_methods_macro_test called_from
|
28
34
|
end
|
29
35
|
end
|
@@ -32,7 +38,8 @@ module Assert::Macros
|
|
32
38
|
alias_method :not_have_imeths, :not_have_instance_method
|
33
39
|
|
34
40
|
def have_class_method(*methods)
|
35
|
-
called_from =
|
41
|
+
called_from =
|
42
|
+
(methods.last.is_a?(Array) ? methods.pop : caller_locations).first
|
36
43
|
Assert::Macro.new do
|
37
44
|
methods.each{ |m| _methods_macro_class_methods << [m, called_from] }
|
38
45
|
_methods_macro_test called_from
|
@@ -43,9 +50,12 @@ module Assert::Macros
|
|
43
50
|
alias_method :have_cmeths, :have_class_method
|
44
51
|
|
45
52
|
def not_have_class_method(*methods)
|
46
|
-
called_from =
|
53
|
+
called_from =
|
54
|
+
(methods.last.is_a?(Array) ? methods.pop : caller_locations).first
|
47
55
|
Assert::Macro.new do
|
48
|
-
methods.each
|
56
|
+
methods.each do |m|
|
57
|
+
_methods_macro_not_class_methods << [m, called_from]
|
58
|
+
end
|
49
59
|
_methods_macro_test called_from
|
50
60
|
end
|
51
61
|
end
|
@@ -54,44 +64,44 @@ module Assert::Macros
|
|
54
64
|
alias_method :not_have_cmeths, :not_have_class_method
|
55
65
|
|
56
66
|
def have_reader(*methods)
|
57
|
-
methods << caller_locations
|
67
|
+
methods << caller_locations unless methods.last.is_a?(Array)
|
58
68
|
have_instance_methods(*methods)
|
59
69
|
end
|
60
70
|
alias_method :have_readers, :have_reader
|
61
71
|
|
62
72
|
def not_have_reader(*methods)
|
63
|
-
methods << caller_locations
|
73
|
+
methods << caller_locations unless methods.last.is_a?(Array)
|
64
74
|
not_have_instance_methods(*methods)
|
65
75
|
end
|
66
76
|
alias_method :not_have_readers, :not_have_reader
|
67
77
|
|
68
78
|
def have_writer(*methods)
|
69
|
-
called = methods.last.
|
70
|
-
writer_meths = methods.collect{|m| "#{m}="}
|
79
|
+
called = methods.last.is_a?(Array) ? methods.pop : caller_locations
|
80
|
+
writer_meths = methods.collect{ |m| "#{m}=" }
|
71
81
|
writer_meths << called
|
72
82
|
have_instance_methods(*writer_meths)
|
73
83
|
end
|
74
84
|
alias_method :have_writers, :have_writer
|
75
85
|
|
76
86
|
def not_have_writer(*methods)
|
77
|
-
called = methods.last.
|
78
|
-
writer_meths = methods.collect{|m| "#{m}="}
|
87
|
+
called = methods.last.is_a?(Array) ? methods.pop : caller_locations
|
88
|
+
writer_meths = methods.collect{ |m| "#{m}=" }
|
79
89
|
writer_meths << called
|
80
90
|
not_have_instance_methods(*writer_meths)
|
81
91
|
end
|
82
92
|
alias_method :not_have_writers, :not_have_writer
|
83
93
|
|
84
94
|
def have_accessor(*methods)
|
85
|
-
called = methods.last.
|
86
|
-
accessor_meths = methods.collect{|m| [m, "#{m}="]}.flatten
|
95
|
+
called = methods.last.is_a?(Array) ? methods.pop : caller_locations
|
96
|
+
accessor_meths = methods.collect{ |m| [m, "#{m}="] }.flatten
|
87
97
|
accessor_meths << called
|
88
98
|
have_instance_methods(*accessor_meths)
|
89
99
|
end
|
90
100
|
alias_method :have_accessors, :have_accessor
|
91
101
|
|
92
102
|
def not_have_accessor(*methods)
|
93
|
-
called = methods.last.
|
94
|
-
accessor_meths = methods.collect{|m| [m, "#{m}="]}.flatten
|
103
|
+
called = methods.last.is_a?(Array) ? methods.pop : caller_locations
|
104
|
+
accessor_meths = methods.collect{ |m| [m, "#{m}="] }.flatten
|
95
105
|
accessor_meths << called
|
96
106
|
not_have_instance_methods(*accessor_meths)
|
97
107
|
end
|
@@ -100,35 +110,51 @@ module Assert::Macros
|
|
100
110
|
# private
|
101
111
|
|
102
112
|
def _methods_macro_test(called_from)
|
103
|
-
@_methods_macro_test ||=
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
113
|
+
@_methods_macro_test ||=
|
114
|
+
test "should respond to methods", called_from do
|
115
|
+
self
|
116
|
+
.class
|
117
|
+
._methods_macro_instance_methods
|
118
|
+
.each do |(method, called_from)|
|
119
|
+
msg =
|
120
|
+
"#{subject.class.name} does not have "\
|
121
|
+
"instance method ##{method}"
|
122
|
+
with_backtrace([called_from]) do
|
123
|
+
assert_that(subject).responds_to(method, msg)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
self
|
128
|
+
.class
|
129
|
+
._methods_macro_class_methods
|
130
|
+
.each do |(method, called_from)|
|
131
|
+
msg =
|
132
|
+
"#{subject.class.name} does not have class method ##{method}"
|
133
|
+
with_backtrace([called_from]) do
|
134
|
+
assert_that(subject.class).responds_to(method, msg)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
self
|
139
|
+
.class
|
140
|
+
._methods_macro_not_instance_methods
|
141
|
+
.each do |(method, called_from)|
|
142
|
+
msg = "#{subject.class.name} has instance method ##{method}"
|
143
|
+
with_backtrace([called_from]) do
|
144
|
+
assert_that(subject).does_not_respond_to(method, msg)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
self
|
149
|
+
.class
|
150
|
+
._methods_macro_not_class_methods
|
151
|
+
.each do |(method, called_from)|
|
152
|
+
msg = "#{subject.class.name} has class method ##{method}"
|
153
|
+
with_backtrace([called_from]) do
|
154
|
+
assert_that(subject.class).does_not_respond_to(method, msg)
|
155
|
+
end
|
156
|
+
end
|
116
157
|
end
|
117
|
-
|
118
|
-
self.class._methods_macro_not_instance_methods.each do |(method, called_from)|
|
119
|
-
msg = "#{subject.class.name} has instance method ##{method}"
|
120
|
-
with_backtrace([called_from]) do
|
121
|
-
assert_that(subject).does_not_respond_to(method, msg)
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
self.class._methods_macro_not_class_methods.each do |(method, called_from)|
|
126
|
-
msg = "#{subject.class.name} has class method ##{method}"
|
127
|
-
with_backtrace([called_from]) do
|
128
|
-
assert_that(subject.class).does_not_respond_to(method, msg)
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|
132
158
|
end
|
133
159
|
|
134
160
|
def _methods_macro_instance_methods
|
data/lib/assert/result.rb
CHANGED
@@ -5,39 +5,44 @@ require "assert/file_line"
|
|
5
5
|
module Assert; end
|
6
6
|
|
7
7
|
module Assert::Result
|
8
|
-
class Base
|
9
|
-
class Pass < Base
|
10
|
-
class Ignore < Base
|
11
|
-
class Fail < Base
|
12
|
-
class Error < Base
|
13
|
-
class Skip < Base
|
8
|
+
class Base; end
|
9
|
+
class Pass < Base; end
|
10
|
+
class Ignore < Base; end
|
11
|
+
class Fail < Base; end
|
12
|
+
class Error < Base; end
|
13
|
+
class Skip < Base; end
|
14
14
|
|
15
15
|
def self.types
|
16
|
-
@types ||= Hash.new{ |
|
16
|
+
@types ||= Hash.new{ |_h, _k| Base }.tap{ |hash|
|
17
17
|
hash[:pass] = Pass
|
18
18
|
hash[:fail] = Fail
|
19
19
|
hash[:ignore] = Ignore
|
20
20
|
hash[:skip] = Skip
|
21
21
|
hash[:error] = Error
|
22
|
-
|
22
|
+
}.freeze
|
23
23
|
end
|
24
24
|
|
25
25
|
def self.new(data = nil)
|
26
26
|
data ||= {}
|
27
|
-
|
27
|
+
types[data[:type]].new(data)
|
28
28
|
end
|
29
29
|
|
30
30
|
class Base
|
31
|
-
def self.type
|
32
|
-
|
31
|
+
def self.type
|
32
|
+
:unknown
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.name
|
36
|
+
""
|
37
|
+
end
|
33
38
|
|
34
39
|
def self.for_test(test, message, bt)
|
35
|
-
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
39
|
-
:
|
40
|
-
:
|
40
|
+
new({
|
41
|
+
test_name: test.name,
|
42
|
+
test_file_line: test.file_line,
|
43
|
+
message: message,
|
44
|
+
output: test.output,
|
45
|
+
backtrace: Backtrace.new(bt),
|
41
46
|
})
|
42
47
|
end
|
43
48
|
|
@@ -59,14 +64,20 @@ module Assert::Result
|
|
59
64
|
end
|
60
65
|
|
61
66
|
def test_file_line
|
62
|
-
@test_file_line ||=
|
67
|
+
@test_file_line ||=
|
68
|
+
(@build_data[:test_file_line] || Assert::FileLine.parse(""))
|
63
69
|
end
|
64
70
|
|
65
|
-
def test_file_name
|
66
|
-
|
71
|
+
def test_file_name
|
72
|
+
test_file_line.file
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_line_num
|
76
|
+
test_file_line.line.to_i
|
77
|
+
end
|
67
78
|
|
68
79
|
def test_id
|
69
|
-
|
80
|
+
test_file_line.to_s
|
70
81
|
end
|
71
82
|
|
72
83
|
def message
|
@@ -108,32 +119,38 @@ module Assert::Result
|
|
108
119
|
end
|
109
120
|
|
110
121
|
def src_line
|
111
|
-
@src_line ||= first_filtered_bt_line(
|
122
|
+
@src_line ||= first_filtered_bt_line(backtrace)
|
112
123
|
end
|
113
124
|
|
114
125
|
def file_line
|
115
|
-
@file_line ||= Assert::FileLine.parse(
|
126
|
+
@file_line ||= Assert::FileLine.parse(src_line)
|
116
127
|
end
|
117
128
|
|
118
|
-
def file_name
|
119
|
-
|
129
|
+
def file_name
|
130
|
+
file_line.file
|
131
|
+
end
|
132
|
+
|
133
|
+
def line_num
|
134
|
+
file_line.line.to_i
|
135
|
+
end
|
120
136
|
|
121
137
|
Assert::Result.types.keys.each do |type|
|
122
138
|
define_method("#{type}?"){ self.type == type }
|
123
139
|
end
|
124
140
|
|
125
|
-
def to_sym
|
141
|
+
def to_sym
|
142
|
+
type
|
143
|
+
end
|
126
144
|
|
127
145
|
def to_s
|
128
|
-
[
|
129
|
-
|
130
|
-
|
131
|
-
].reject(&:empty?).join("\n")
|
146
|
+
["#{name.upcase}: #{test_name}", message, trace]
|
147
|
+
.reject(&:empty?)
|
148
|
+
.join("\n")
|
132
149
|
end
|
133
150
|
|
134
|
-
def ==(
|
135
|
-
if
|
136
|
-
|
151
|
+
def ==(other)
|
152
|
+
if other.is_a?(self.class)
|
153
|
+
type == other.type && message == other.message
|
137
154
|
else
|
138
155
|
super
|
139
156
|
end
|
@@ -141,9 +158,9 @@ module Assert::Result
|
|
141
158
|
|
142
159
|
def inspect
|
143
160
|
"#<#{self.class}:#{"0x0%x" % (object_id << 1)} "\
|
144
|
-
"@message=#{
|
145
|
-
"@file_line=#{
|
146
|
-
"@test_file_line=#{
|
161
|
+
"@message=#{message.inspect} "\
|
162
|
+
"@file_line=#{file_line.to_s.inspect} "\
|
163
|
+
"@test_file_line=#{test_file_line.to_s.inspect}>"
|
147
164
|
end
|
148
165
|
|
149
166
|
private
|
@@ -153,10 +170,10 @@ module Assert::Result
|
|
153
170
|
# filtered line of the backtrace). This is overridden for error results
|
154
171
|
# as they always show their full backtrace.
|
155
172
|
def build_trace
|
156
|
-
if
|
157
|
-
Backtrace.to_s(@with_bt+[first_filtered_bt_line(
|
173
|
+
if with_bt_set?
|
174
|
+
Backtrace.to_s(@with_bt + [first_filtered_bt_line(backtrace)])
|
158
175
|
else
|
159
|
-
|
176
|
+
src_line
|
160
177
|
end
|
161
178
|
end
|
162
179
|
|
@@ -169,13 +186,23 @@ module Assert::Result
|
|
169
186
|
end
|
170
187
|
|
171
188
|
class Pass < Base
|
172
|
-
def self.type
|
173
|
-
|
189
|
+
def self.type
|
190
|
+
:pass
|
191
|
+
end
|
192
|
+
|
193
|
+
def self.name
|
194
|
+
"Pass"
|
195
|
+
end
|
174
196
|
end
|
175
197
|
|
176
198
|
class Ignore < Base
|
177
|
-
def self.type
|
178
|
-
|
199
|
+
def self.type
|
200
|
+
:ignore
|
201
|
+
end
|
202
|
+
|
203
|
+
def self.name
|
204
|
+
"Ignore"
|
205
|
+
end
|
179
206
|
end
|
180
207
|
|
181
208
|
class HaltingTestResultError < RuntimeError
|
@@ -186,17 +213,26 @@ module Assert::Result
|
|
186
213
|
TestFailure = Class.new(HaltingTestResultError)
|
187
214
|
|
188
215
|
class Fail < Base
|
189
|
-
def self.type
|
190
|
-
|
216
|
+
def self.type
|
217
|
+
:fail
|
218
|
+
end
|
219
|
+
|
220
|
+
def self.name
|
221
|
+
"Fail"
|
222
|
+
end
|
191
223
|
|
192
|
-
# fail results can be generated manually or by raising
|
224
|
+
# fail results can be generated manually or by raising
|
225
|
+
# Assert::Result::TestFailure
|
193
226
|
def self.for_test(test, msg_or_err, bt = nil)
|
194
|
-
if msg_or_err.
|
227
|
+
if msg_or_err.is_a?(TestFailure)
|
195
228
|
super(test, msg_or_err.message, msg_or_err.backtrace).tap do |result|
|
196
229
|
result.set_with_bt(msg_or_err.assert_with_bt)
|
197
230
|
end
|
198
|
-
elsif msg_or_err.
|
199
|
-
raise
|
231
|
+
elsif msg_or_err.is_a?(Exception)
|
232
|
+
raise(
|
233
|
+
ArgumentError,
|
234
|
+
"generate fail results by raising Assert::Result::TestFailure",
|
235
|
+
)
|
200
236
|
else
|
201
237
|
super(test, msg_or_err, bt)
|
202
238
|
end
|
@@ -207,17 +243,25 @@ module Assert::Result
|
|
207
243
|
TestSkipped = Class.new(HaltingTestResultError)
|
208
244
|
|
209
245
|
class Skip < Base
|
210
|
-
def self.type
|
211
|
-
|
246
|
+
def self.type
|
247
|
+
:skip
|
248
|
+
end
|
249
|
+
|
250
|
+
def self.name
|
251
|
+
"Skip"
|
252
|
+
end
|
212
253
|
|
213
254
|
# skip results are generated by raising Assert::Result::TestSkipped
|
214
255
|
def self.for_test(test, msg_or_err, bt = nil)
|
215
|
-
if msg_or_err.
|
256
|
+
if msg_or_err.is_a?(TestSkipped)
|
216
257
|
super(test, msg_or_err.message, msg_or_err.backtrace).tap do |result|
|
217
258
|
result.set_with_bt(msg_or_err.assert_with_bt)
|
218
259
|
end
|
219
|
-
elsif msg_or_err.
|
220
|
-
raise
|
260
|
+
elsif msg_or_err.is_a?(Exception)
|
261
|
+
raise(
|
262
|
+
ArgumentError,
|
263
|
+
"generate skip results by raising Assert::Result::TestSkipped",
|
264
|
+
)
|
221
265
|
else
|
222
266
|
super(test, msg_or_err, bt)
|
223
267
|
end
|
@@ -225,12 +269,17 @@ module Assert::Result
|
|
225
269
|
end
|
226
270
|
|
227
271
|
class Error < Base
|
228
|
-
def self.type
|
229
|
-
|
272
|
+
def self.type
|
273
|
+
:error
|
274
|
+
end
|
275
|
+
|
276
|
+
def self.name
|
277
|
+
"Error"
|
278
|
+
end
|
230
279
|
|
231
280
|
# error results are generated by raising exceptions in tests
|
232
281
|
def self.for_test(test, err)
|
233
|
-
if err.
|
282
|
+
if err.is_a?(Exception)
|
234
283
|
super(test, "#{err.message} (#{err.class.name})", err.backtrace)
|
235
284
|
else
|
236
285
|
raise ArgumentError, "generate error results by raising an exception"
|
@@ -246,10 +295,10 @@ module Assert::Result
|
|
246
295
|
end
|
247
296
|
|
248
297
|
class Backtrace < ::Array
|
249
|
-
DELIM = "\n"
|
298
|
+
DELIM = "\n"
|
250
299
|
|
251
300
|
def self.parse(bt)
|
252
|
-
|
301
|
+
new(bt.to_s.split(DELIM))
|
253
302
|
end
|
254
303
|
|
255
304
|
def self.to_s(bt_array)
|
@@ -261,7 +310,7 @@ module Assert::Result
|
|
261
310
|
end
|
262
311
|
|
263
312
|
def filtered
|
264
|
-
self.class.new(
|
313
|
+
self.class.new(reject{ |line| filter_out?(line.to_s) })
|
265
314
|
end
|
266
315
|
|
267
316
|
protected
|
@@ -271,8 +320,8 @@ module Assert::Result
|
|
271
320
|
# "./lib" in project dir, or "/usr/local/blahblah" if installed
|
272
321
|
assert_lib_path = File.expand_path("../..", __FILE__)
|
273
322
|
assert_macros_path = File.join(assert_lib_path, "assert/macros")
|
274
|
-
assert_bin_regex = /
|
275
|
-
(
|
323
|
+
assert_bin_regex = %r{bin/assert\:}
|
324
|
+
(line.rindex(assert_lib_path, 0) &&
|
276
325
|
!line.rindex(assert_macros_path, 0)
|
277
326
|
) ||
|
278
327
|
line =~ assert_bin_regex
|