8000 Apply these doc lessons to strict_predicate_matchers · rspec/rspec@7ccd6a3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7ccd6a3

Browse files
committed
Apply these doc lessons to strict_predicate_matchers
1 parent 5efa326 commit 7ccd6a3

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

rspec-expectations/lib/rspec/expectations/configuration.rb

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,20 @@ def on_potential_false_positives=(behavior)
208208
# Configures RSpec to check predicate matchers to `be(true)` / `be(false)` (strict),
209209
# or `be_truthy` / `be_falsey` (not strict).
210210
# Historically, the default was `false`, but `true` is recommended.
211-
def strict_predicate_matchers=(flag)
212-
raise ArgumentError, "Pass `true` or `false`" unless flag == true || flag == false
213-
@strict_predicate_matchers = flag
214-
end
215-
211+
#
212+
# @overload strict_predicate_matchers
213+
# @return [Boolean]
214+
# @overload strict_predicate_matchers?
215+
# @return [Boolean]
216+
# @overload strict_predicate_matchers=(value)
217+
# @param [Boolean] value
216218
attr_reader :strict_predicate_matchers
217219

220+
def strict_predicate_matchers=(value)
221+
raise ArgumentError, "Pass `true` or `false`" unless value == true || value == false
222+
@strict_predicate_matchers = value
223+
end
224+
218225
def strict_predicate_matchers?
219226
@strict_predicate_matchers
220227
end

0 commit comments

Comments
 (0)
0