assert 2.18.4 → 2.19.4

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