3
3
module RSpec
4
4
module Rails
5
5
module Matchers
6
- # @api private
7
- # Sentinel value to distinguish between no argument passed vs explicitly passed nil.
8
- # This follows the same pattern as RSpec's raise_error matcher.
9
- UndefinedValue = Object . new . freeze
10
6
ErrorCollector = ActiveSupport ::Testing ::ErrorReporterAssertions ::ErrorCollector
11
7
12
8
# Matcher class for `have_reported_error`. Should not be instantiated directly.
@@ -16,19 +12,19 @@ module Matchers
16
12
# @api private
17
13
# @see RSpec::Rails::Matchers#have_reported_error
18
14
class HaveReportedError < RSpec ::Rails ::Matchers ::BaseMatcher
19
- # Uses UndefinedValue as default to distinguish between no argument
15
+ # Uses UNDEFINED as default to distinguish between no argument
20
16
# passed vs explicitly passed nil.
21
17
#
22
18
# @param expected_error_or_message [Class, String, Regexp, nil]
23
19
# Error class, message string, or message pattern
24
20
# @param expected_message [String, Regexp, nil]
25
21
# Expected message when first param is a class
26
- def initialize ( expected_error_or_message = UndefinedValue , expected_message = nil )
22
+ def initialize ( expected_error_or_message = UNDEFINED , expected_message = nil )
27
23
@attributes = { }
28
24
@warn_about_nil_error = expected_error_or_message . nil?
29
25
30
26
case expected_error_or_message
31
- when UndefinedValue
27
+ when UNDEFINED
32
28
@expected_error = nil
33
29
@expected_message = expected_message
34
30
when String , Regexp
@@ -248,7 +244,7 @@ def warn_about_nil_error!
248
244
#
249
245
# @param expected_error_or_message [Class, String, Regexp, nil] the expected error class, message string, or message pattern
250
246
# @param expected_message [String, Regexp, nil] the expected error message to match
251
- def have_reported_error ( expected_error_or_message = UndefinedValue , expected_message = nil )
247
+ def have_reported_error ( expected_error_or_message = HaveReportedError :: UNDEFINED , expected_message = nil )
252
248
HaveReportedError . new ( expected_error_or_message , expected_message )
253
249
end
254
250
0 commit comments