assert 2.16.3 → 2.16.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
- SHA512:
3
- metadata.gz: 2f4a1019a10e96ae935cb6aa9fc17f93e5965659f3e401d367f5a81fe260960b28f1741218eaf2b9f9ca7993ba0fc6cbce5b447c78f9289812014daeb8c74108
4
- data.tar.gz: d6a0657a4041933cadd0e238571cabd9092bbe4e4e7db2470deb75c80689c3ccf6df4601136ae8a4e910eaa815bb5066c7a5df875750aea5bd1300cdf1e5ff34
5
2
  SHA1:
6
- metadata.gz: b2d74dbdecb01c84ed0131687f80d59da6b020ce
7
- data.tar.gz: c9b15366dba845affe5b51466c6e6c836b5c7658
3
+ data.tar.gz: 1140a1218d3b3df2195ab376b494b275155951e2
4
+ metadata.gz: e696cad6f5a6a309c43c72c059f7072ad7b5fa28
5
+ SHA512:
6
+ data.tar.gz: d819e6364e40bd86571d63e87b93ca4277f441914d25b862543504a58eef9ab6cc8c29a95e7db502288e526b8de62abc52c355c3f21bf372ab57d2f1a87cc00d
7
+ metadata.gz: 6bd08bca020ce2e980da50aec61e574270c2e77e1441d3fc84c50d91b60651713c367b00c8aa78478abdb5bb2b0a379eb120ec73cd14c27d94a049f07bb0ac25
data/README.md CHANGED
@@ -557,6 +557,7 @@ Available callbacks from the runner, and when they are called:
557
557
  * `on_result`: when a running tests generates a result, the result is passed as an arg
558
558
  * `after_test`: after a test finishes running, the test is passed as an arg
559
559
  * `on_finish`: when the test suite is finished running
560
+ * `on_info`: called when the INFO signal is triggered while running the test suite (Ctrl-T on Macs)
560
561
  * `on_interrupt`: called when the test suite is interrupted while running
561
562
 
562
563
  Beyond that, each view can do as it sees fit. Initialize how you wish, take whatever settings you'd like, and output results as you see fit, given the available callbacks.
@@ -23,3 +23,12 @@ module Assert
23
23
  end
24
24
 
25
25
  end
26
+
27
+ # Kernel#caller_locations polyfill for pre ruby 2.0.0
28
+ if RUBY_VERSION =~ /\A1\..+/ && !Kernel.respond_to?(:caller_locations)
29
+ module Kernel
30
+ def caller_locations(start = 1, length = nil)
31
+ length ? caller[start, length] : caller[start..-1]
32
+ end
33
+ end
34
+ end
@@ -34,14 +34,14 @@ module Assert
34
34
 
35
35
  if self.suite.test_methods.include?(klass_method_name)
36
36
  puts "WARNING: redefining '#{klass_method_name}'"
37
- puts " from: #{caller.first}"
37
+ puts " from: #{caller_locations(1,1)}"
38
38
  else
39
39
  self.suite.test_methods << klass_method_name
40
40
  end
41
41
 
42
42
  self.suite.on_test(Test.for_method(
43
43
  method_name.to_s,
44
- ContextInfo.new(self, nil, caller.first),
44
+ ContextInfo.new(self, nil, caller_locations(1,1)),
45
45
  self.suite.config
46
46
  ))
47
47
  end
@@ -50,10 +50,13 @@ module Assert
50
50
  def initialize(running_test, config, result_callback)
51
51
  @__assert_running_test__ = running_test
52
52
  @__assert_config__ = config
53
- @__assert_with_bt__ = nil
53
+ @__assert_with_bt__ = []
54
+ @__assert_pending__ = 0
54
55
 
55
56
  @__assert_result_callback__ = proc do |result|
56
- result.set_backtrace(@__assert_with_bt__) if @__assert_with_bt__
57
+ if !@__assert_with_bt__.empty?
58
+ result.set_with_bt(@__assert_with_bt__.dup)
59
+ end
57
60
  result_callback.call(result)
58
61
  result
59
62
  end
@@ -89,7 +92,12 @@ module Assert
89
92
  # adds a Pass result to the end of the test's results
90
93
  # does not break test execution
91
94
  def pass(pass_msg = nil)
92
- capture_result(Assert::Result::Pass, pass_msg)
95
+ if @__assert_pending__ == 0
96
+ capture_result(Assert::Result::Pass, pass_msg)
97
+ else
98
+ capture_result(Assert::Result::Fail, "Pending pass (make it "\
99
+ "not pending)")
100
+ end
93
101
  end
94
102
 
95
103
  # adds an Ignore result to the end of the test's results
@@ -101,10 +109,18 @@ module Assert
101
109
  # adds a Fail result to the end of the test's results
102
110
  # break test execution if assert is configured to halt on failures
103
111
  def fail(message = nil)
104
- if halt_on_fail?
105
- raise Result::TestFailure, message || ''
112
+ if @__assert_pending__ == 0
113
+ if halt_on_fail?
114
+ raise Result::TestFailure, message || ''
115
+ else
116
+ capture_result(Assert::Result::Fail, message || '')
117
+ end
106
118
  else
107
- capture_result(Assert::Result::Fail, message || '')
119
+ if halt_on_fail?
120
+ raise Result::TestSkipped, "Pending fail: #{message || ''}"
121
+ else
122
+ capture_result(Assert::Result::Skip, "Pending fail: #{message || ''}")
123
+ end
108
124
  end
109
125
  end
110
126
  alias_method :flunk, :fail
@@ -112,21 +128,32 @@ module Assert
112
128
  # adds a Skip result to the end of the test's results
113
129
  # breaks test execution
114
130
  def skip(skip_msg = nil, called_from = nil)
115
- err = Result::TestSkipped.new(skip_msg || '')
116
- err.set_backtrace([called_from]) if called_from
117
- raise(err)
131
+ raise Result::TestSkipped, (skip_msg || ''), called_from
132
+ end
133
+
134
+ # runs block and any fails are skips and any passes are fails
135
+ def pending(&block)
136
+ begin
137
+ @__assert_pending__ += 1
138
+ instance_eval(&block)
139
+ ensure
140
+ @__assert_pending__ -= 1
141
+ end
118
142
  end
119
143
 
120
144
  # alter the backtraces of fail/skip results generated in the given block
121
145
  def with_backtrace(bt, &block)
122
146
  bt ||= []
123
147
  begin
124
- @__assert_with_bt__ = bt
148
+ @__assert_with_bt__.push(bt.first)
125
149
  instance_eval(&block)
126
150
  rescue Result::TestSkipped, Result::TestFailure => e
127
- e.set_backtrace(@__assert_with_bt__); raise(e)
151
+ if e.assert_with_bt.nil? && !@__assert_with_bt__.empty?
152
+ e.assert_with_bt = @__assert_with_bt__.dup
153
+ end
154
+ raise(e)
128
155
  ensure
129
- @__assert_with_bt__ = nil
156
+ @__assert_with_bt__.pop
130
157
  end
131
158
  end
132
159
 
@@ -156,7 +183,7 @@ module Assert
156
183
 
157
184
  def capture_result(result_klass, msg)
158
185
  @__assert_result_callback__.call(
159
- result_klass.for_test(@__assert_running_test__, msg, caller)
186
+ result_klass.for_test(@__assert_running_test__, msg, caller_locations)
160
187
  )
161
188
  end
162
189
 
@@ -15,23 +15,23 @@ class Assert::Context
15
15
  # create a test from the given code block
16
16
  self.suite.on_test(Assert::Test.for_block(
17
17
  desc_or_macro.kind_of?(Assert::Macro) ? desc_or_macro.name : desc_or_macro,
18
- Assert::ContextInfo.new(self, called_from, first_caller || caller.first),
18
+ Assert::ContextInfo.new(self, called_from, first_caller || caller_locations.first),
19
19
  self.suite.config,
20
20
  &block
21
21
  ))
22
22
  else
23
- test_eventually(desc_or_macro, called_from, first_caller || caller.first, &block)
23
+ test_eventually(desc_or_macro, called_from, first_caller || caller_locations.first, &block)
24
24
  end
25
25
  end
26
26
 
27
27
  def test_eventually(desc_or_macro, called_from = nil, first_caller = nil, &block)
28
28
  # create a test from a proc that just skips
29
- ci = Assert::ContextInfo.new(self, called_from, first_caller || caller.first)
29
+ ci = Assert::ContextInfo.new(self, called_from, first_caller || caller_locations.first)
30
30
  self.suite.on_test(Assert::Test.for_block(
31
31
  desc_or_macro.kind_of?(Assert::Macro) ? desc_or_macro.name : desc_or_macro,
32
32
  ci,
33
33
  self.suite.config,
34
- &proc { skip('TODO', ci.called_from) }
34
+ &proc { skip('TODO', [ci.called_from.to_s]) }
35
35
  ))
36
36
  end
37
37
  alias_method :test_skip, :test_eventually
@@ -40,14 +40,14 @@ class Assert::Context
40
40
  if !desc_or_macro.kind_of?(Assert::Macro)
41
41
  desc_or_macro = "should #{desc_or_macro}"
42
42
  end
43
- test(desc_or_macro, called_from, first_caller || caller.first, &block)
43
+ test(desc_or_macro, called_from, first_caller || caller_locations.first, &block)
44
44
  end
45
45
 
46
46
  def should_eventually(desc_or_macro, called_from = nil, first_caller = nil, &block)
47
47
  if !desc_or_macro.kind_of?(Assert::Macro)
48
48
  desc_or_macro = "should #{desc_or_macro}"
49
49
  end
50
- test_eventually(desc_or_macro, called_from, first_caller || caller.first, &block)
50
+ test_eventually(desc_or_macro, called_from, first_caller || caller_locations.first, &block)
51
51
  end
52
52
  alias_method :should_skip, :should_eventually
53
53
 
@@ -7,7 +7,7 @@ module Assert
7
7
  def initialize(klass, called_from = nil, first_caller = nil)
8
8
  @called_from = called_from || first_caller
9
9
  @klass = klass
10
- @file = @called_from.gsub(/\:[0-9]+.*$/, '') if @called_from
10
+ @file = @called_from.to_s.gsub(/\:[0-9]+.*$/, '') if @called_from
11
11
  end
12
12
 
13
13
  def test_name(name)
@@ -59,6 +59,15 @@ module Assert
59
59
  "#{formatted_suite_result_rate} results/s)"
60
60
  end
61
61
 
62
+ def on_info(test)
63
+ dump_test_results
64
+
65
+ puts "Current test:"
66
+ puts test.name
67
+ puts test.file_line.to_s
68
+ puts
69
+ end
70
+
62
71
  def on_interrupt(err)
63
72
  dump_test_results
64
73
  end
@@ -10,7 +10,7 @@ module Assert::Macros
10
10
  module ClassMethods
11
11
 
12
12
  def have_instance_method(*methods)
13
- called_from = (methods.last.kind_of?(Array) ? methods.pop : caller).first
13
+ called_from = (methods.last.kind_of?(Array) ? methods.pop : caller_locations).first
14
14
  Assert::Macro.new do
15
15
  methods.each{ |m| _methods_macro_instance_methods << [m, called_from] }
16
16
  _methods_macro_test called_from
@@ -21,7 +21,7 @@ module Assert::Macros
21
21
  alias_method :have_imeths, :have_instance_method
22
22
 
23
23
  def not_have_instance_method(*methods)
24
- called_from = (methods.last.kind_of?(Array) ? methods.pop : caller).first
24
+ called_from = (methods.last.kind_of?(Array) ? methods.pop : caller_locations).first
25
25
  Assert::Macro.new do
26
26
  methods.each{ |m| _methods_macro_not_instance_methods << [m, called_from] }
27
27
  _methods_macro_test called_from
@@ -32,7 +32,7 @@ module Assert::Macros
32
32
  alias_method :not_have_imeths, :not_have_instance_method
33
33
 
34
34
  def have_class_method(*methods)
35
- called_from = (methods.last.kind_of?(Array) ? methods.pop : caller).first
35
+ called_from = (methods.last.kind_of?(Array) ? methods.pop : caller_locations).first
36
36
  Assert::Macro.new do
37
37
  methods.each{ |m| _methods_macro_class_methods << [m, called_from] }
38
38
  _methods_macro_test called_from
@@ -43,7 +43,7 @@ module Assert::Macros
43
43
  alias_method :have_cmeths, :have_class_method
44
44
 
45
45
  def not_have_class_method(*methods)
46
- called_from = (methods.last.kind_of?(Array) ? methods.pop : caller).first
46
+ called_from = (methods.last.kind_of?(Array) ? methods.pop : caller_locations).first
47
47
  Assert::Macro.new do
48
48
  methods.each{ |m| _methods_macro_not_class_methods << [m, called_from] }
49
49
  _methods_macro_test called_from
@@ -54,19 +54,19 @@ module Assert::Macros
54
54
  alias_method :not_have_cmeths, :not_have_class_method
55
55
 
56
56
  def have_reader(*methods)
57
- methods << caller if !methods.last.kind_of?(Array)
57
+ methods << caller_locations if !methods.last.kind_of?(Array)
58
58
  have_instance_methods(*methods)
59
59
  end
60
60
  alias_method :have_readers, :have_reader
61
61
 
62
62
  def not_have_reader(*methods)
63
- methods << caller if !methods.last.kind_of?(Array)
63
+ methods << caller_locations if !methods.last.kind_of?(Array)
64
64
  not_have_instance_methods(*methods)
65
65
  end
66
66
  alias_method :not_have_readers, :not_have_reader
67
67
 
68
68
  def have_writer(*methods)
69
- called = methods.last.kind_of?(Array) ? methods.pop : caller
69
+ called = methods.last.kind_of?(Array) ? methods.pop : caller_locations
70
70
  writer_meths = methods.collect{|m| "#{m}="}
71
71
  writer_meths << called
72
72
  have_instance_methods(*writer_meths)
@@ -74,7 +74,7 @@ module Assert::Macros
74
74
  alias_method :have_writers, :have_writer
75
75
 
76
76
  def not_have_writer(*methods)
77
- called = methods.last.kind_of?(Array) ? methods.pop : caller
77
+ called = methods.last.kind_of?(Array) ? methods.pop : caller_locations
78
78
  writer_meths = methods.collect{|m| "#{m}="}
79
79
  writer_meths << called
80
80
  not_have_instance_methods(*writer_meths)
@@ -82,7 +82,7 @@ module Assert::Macros
82
82
  alias_method :not_have_writers, :not_have_writer
83
83
 
84
84
  def have_accessor(*methods)
85
- called = methods.last.kind_of?(Array) ? methods.pop : caller
85
+ called = methods.last.kind_of?(Array) ? methods.pop : caller_locations
86
86
  accessor_meths = methods.collect{|m| [m, "#{m}="]}.flatten
87
87
  accessor_meths << called
88
88
  have_instance_methods(*accessor_meths)
@@ -90,7 +90,7 @@ module Assert::Macros
90
90
  alias_method :have_accessors, :have_accessor
91
91
 
92
92
  def not_have_accessor(*methods)
93
- called = methods.last.kind_of?(Array) ? methods.pop : caller
93
+ called = methods.last.kind_of?(Array) ? methods.pop : caller_locations
94
94
  accessor_meths = methods.collect{|m| [m, "#{m}="]}.flatten
95
95
  accessor_meths << called
96
96
  not_have_instance_methods(*accessor_meths)
@@ -104,28 +104,28 @@ module Assert::Macros
104
104
 
105
105
  self.class._methods_macro_instance_methods.each do |(method, called_from)|
106
106
  msg = "#{subject.class.name} does not have instance method ##{method}"
107
- with_backtrace(called_from) do
107
+ with_backtrace([called_from]) do
108
108
  assert_respond_to method, subject, msg
109
109
  end
110
110
  end
111
111
 
112
112
  self.class._methods_macro_class_methods.each do |(method, called_from)|
113
113
  msg = "#{subject.class.name} does not have class method ##{method}"
114
- with_backtrace(called_from) do
114
+ with_backtrace([called_from]) do
115
115
  assert_respond_to method, subject.class, msg
116
116
  end
117
117
  end
118
118
 
119
119
  self.class._methods_macro_not_instance_methods.each do |(method, called_from)|
120
120
  msg = "#{subject.class.name} has instance method ##{method}"
121
- with_backtrace(called_from) do
121
+ with_backtrace([called_from]) do
122
122
  assert_not_respond_to method, subject, msg
123
123
  end
124
124
  end
125
125
 
126
126
  self.class._methods_macro_not_class_methods.each do |(method, called_from)|
127
127
  msg = "#{subject.class.name} has class method ##{method}"
128
- with_backtrace(called_from) do
128
+ with_backtrace([called_from]) do
129
129
  assert_not_respond_to method, subject.class, msg
130
130
  end
131
131
  end
@@ -3,12 +3,12 @@ require 'assert/file_line'
3
3
  module Assert; end
4
4
  module Assert::Result
5
5
 
6
- class Base; end
7
- class Pass < Base; end
8
- class Ignore < Base; end
9
- class Fail < Base; end
10
- class Error < Base; end
11
- class Skip < Base; end
6
+ class Base ; end
7
+ class Pass < Base ; end
8
+ class Ignore < Base ; end
9
+ class Fail < Base ; end
10
+ class Error < Base ; end
11
+ class Skip < Base ; end
12
12
 
13
13
  def self.types
14
14
  @types ||= Hash.new{ |h, k| Base }.tap do |hash|
@@ -42,6 +42,7 @@ module Assert::Result
42
42
 
43
43
  def initialize(build_data)
44
44
  @build_data = build_data
45
+ @with_bt = nil
45
46
  end
46
47
 
47
48
  def type
@@ -80,19 +81,37 @@ module Assert::Result
80
81
  end
81
82
 
82
83
  def trace
83
- @trace ||= (@build_data[:trace] || build_trace(self.backtrace))
84
+ @trace ||= build_trace
84
85
  end
85
86
 
86
87
  # we choose to implement this way instead of using an `attr_writer` to be
87
88
  # consistant with how you override exception backtraces.
88
89
  def set_backtrace(bt)
89
90
  @backtrace = Backtrace.new(bt)
90
- @trace = build_trace(@backtrace)
91
- @file_line = Assert::FileLine.parse(first_filtered_bt_line(@backtrace))
91
+ @src_line = nil
92
+ @file_line = nil
93
+ @trace = nil
94
+ end
95
+
96
+ # set the given with bt and the src line for with bt
97
+ def set_with_bt(with_bt)
98
+ return if with_bt.nil?
99
+ @with_bt = with_bt
100
+ @src_line = with_bt.first
101
+ @file_line = nil
102
+ @trace = nil
103
+ end
104
+
105
+ def with_bt_set?
106
+ !@with_bt.nil?
107
+ end
108
+
109
+ def src_line
110
+ @src_line ||= first_filtered_bt_line(self.backtrace)
92
111
  end
93
112
 
94
113
  def file_line
95
- @file_line ||= Assert::FileLine.parse(first_filtered_bt_line(self.backtrace))
114
+ @file_line ||= Assert::FileLine.parse(self.src_line)
96
115
  end
97
116
 
98
117
  def file_name; self.file_line.file; end
@@ -124,15 +143,21 @@ module Assert::Result
124
143
 
125
144
  private
126
145
 
127
- # by default, a result's trace is the first line of its filtered backtrace
128
- # if the filtered backtrace is empty, just use the backtrace itself (this
129
- # should only occur if the result is an error from a line in assert's
130
- # non-test code). This is overridden for error results as they always show
131
- # the entire backtrace
132
- def build_trace(backtrace)
133
- first_filtered_bt_line(backtrace)
146
+ # By default, a result's trace is its `src_line`. If a with bt has been
147
+ # set, display it in full along with the "original src line" (the first
148
+ # filtered line of the backtrace). This is overridden for error results
149
+ # as they always show their full backtrace.
150
+ def build_trace
151
+ if self.with_bt_set?
152
+ Backtrace.to_s(@with_bt+[first_filtered_bt_line(self.backtrace)])
153
+ else
154
+ self.src_line
155
+ end
134
156
  end
135
157
 
158
+ # if the filtered backtrace is empty, just use the backtrace itself (this
159
+ # should only occur if the result is an error from a line in assert's
160
+ # non-test code).
136
161
  def first_filtered_bt_line(backtrace)
137
162
  ((fbt = backtrace.filtered).empty? ? backtrace : fbt).first.to_s
138
163
  end
@@ -152,8 +177,12 @@ module Assert::Result
152
177
 
153
178
  end
154
179
 
180
+ class HaltingTestResultError < RuntimeError
181
+ attr_accessor :assert_with_bt
182
+ end
183
+
155
184
  # raised by the 'fail' context helper to break test execution
156
- TestFailure = Class.new(RuntimeError)
185
+ TestFailure = Class.new(HaltingTestResultError)
157
186
 
158
187
  class Fail < Base
159
188
 
@@ -161,20 +190,22 @@ module Assert::Result
161
190
  def self.name; 'Fail'; end
162
191
 
163
192
  # fail results can be generated manually or by raising Assert::Result::TestFailure
164
- def self.for_test(test, message_or_exception, bt = nil)
165
- if message_or_exception.kind_of?(TestFailure)
166
- super(test, message_or_exception.message, message_or_exception.backtrace)
167
- elsif message_or_exception.kind_of?(Exception)
193
+ def self.for_test(test, msg_or_err, bt = nil)
194
+ if msg_or_err.kind_of?(TestFailure)
195
+ super(test, msg_or_err.message, msg_or_err.backtrace).tap do |result|
196
+ result.set_with_bt(msg_or_err.assert_with_bt)
197
+ end
198
+ elsif msg_or_err.kind_of?(Exception)
168
199
  raise ArgumentError, "generate fail results by raising Assert::Result::TestFailure"
169
200
  else
170
- super(test, message_or_exception, bt)
201
+ super(test, msg_or_err, bt)
171
202
  end
172
203
  end
173
204
 
174
205
  end
175
206
 
176
207
  # raised by the 'skip' context helper to break test execution
177
- TestSkipped = Class.new(RuntimeError)
208
+ TestSkipped = Class.new(HaltingTestResultError)
178
209
 
179
210
  class Skip < Base
180
211
 
@@ -182,11 +213,15 @@ module Assert::Result
182
213
  def self.name; 'Skip'; end
183
214
 
184
215
  # skip results are generated by raising Assert::Result::TestSkipped
185
- def self.for_test(test, exception)
186
- if exception.kind_of?(TestSkipped)
187
- super(test, exception.message, exception.backtrace)
188
- else
216
+ def self.for_test(test, msg_or_err, bt = nil)
217
+ if msg_or_err.kind_of?(TestSkipped)
218
+ super(test, msg_or_err.message, msg_or_err.backtrace).tap do |result|
219
+ result.set_with_bt(msg_or_err.assert_with_bt)
220
+ end
221
+ elsif msg_or_err.kind_of?(Exception)
189
222
  raise ArgumentError, "generate skip results by raising Assert::Result::TestSkipped"
223
+ else
224
+ super(test, msg_or_err, bt)
190
225
  end
191
226
  end
192
227
 
@@ -198,9 +233,9 @@ module Assert::Result
198
233
  def self.name; 'Error'; end
199
234
 
200
235
  # error results are generated by raising exceptions in tests
201
- def self.for_test(test, exception)
202
- if exception.kind_of?(Exception)
203
- super(test, "#{exception.message} (#{exception.class.name})", exception.backtrace)
236
+ def self.for_test(test, err)
237
+ if err.kind_of?(Exception)
238
+ super(test, "#{err.message} (#{err.class.name})", err.backtrace)
204
239
  else
205
240
  raise ArgumentError, "generate error results by raising an exception"
206
241
  end
@@ -209,7 +244,9 @@ module Assert::Result
209
244
  private
210
245
 
211
246
  # override of the base, always show the full unfiltered backtrace for errors
212
- def build_trace(backtrace); backtrace.to_s; end
247
+ def build_trace
248
+ Backtrace.to_s(backtrace)
249
+ end
213
250
 
214
251
  end
215
252
 
@@ -217,16 +254,20 @@ module Assert::Result
217
254
 
218
255
  DELIM = "\n".freeze
219
256
 
220
- def self.parse(bt); self.new(bt.to_s.split(DELIM)); end
257
+ def self.parse(bt)
258
+ self.new(bt.to_s.split(DELIM))
259
+ end
260
+
261
+ def self.to_s(bt_array)
262
+ bt_array.join(DELIM)
263
+ end
221
264
 
222
265
  def initialize(value = nil)
223
266
  super([*(value || "No backtrace")])
224
267
  end
225
268
 
226
- def to_s; self.join(DELIM); end
227
-
228
269
  def filtered
229
- self.class.new(self.reject { |line| filter_out?(line) })
270
+ self.class.new(self.reject { |line| filter_out?(line.to_s) })
230
271
  end
231
272
 
232
273
  protected
@@ -234,9 +275,13 @@ module Assert::Result
234
275
  # filter a line out if it's an assert lib/bin line
235
276
  def filter_out?(line)
236
277
  # './lib' in project dir, or '/usr/local/blahblah' if installed
237
- assert_lib_path = File.expand_path('../..', __FILE__)
278
+ assert_lib_path = File.expand_path('../..', __FILE__)
279
+ assert_macros_path = File.join(assert_lib_path, 'assert/macros')
238
280
  assert_bin_regex = /bin\/assert\:/
239
- line.rindex(assert_lib_path, 0) || line =~ assert_bin_regex
281
+ ( line.rindex(assert_lib_path, 0) &&
282
+ !line.rindex(assert_macros_path, 0)
283
+ ) ||
284
+ line =~ assert_bin_regex
240
285
  end
241
286
 
242
287
  end