Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 183b391

Browse files
committed
Define correct predicates such that config.xxx? returns true/false
Notes: * no idea why the `remove_method` is needed now and wasn't needed previously * no spec failure as specs use `be_falsey` and `be_truthy`
1 parent 119282e commit 183b391

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/rspec/core/configuration.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,13 @@ def self.define_aliases(name, alias_name)
7575

7676
# @private
7777
def self.define_predicate_for(*names)
78-
names.each { |name| alias_method "#{name}?", name }
78+
names.each do |name|
79+
class_eval <<~PREDICATE, __FILE__ , __LINE__ + 1
80+
def #{name}?
81+
!!#{name}
82+
end
83+
PREDICATE
84+
end
7985
end
8086

8187
# @private
@@ -1038,6 +1044,7 @@ def reporter
10381044
#
10391045
# Defaults `profile_examples` to 10 examples when `@profile_examples` is
10401046
# `true`.
1047+
remove_method :profile_examples
10411048
def profile_examples
10421049
profile = value_for(:profile_examples) { @profile_examples }
10431050
if profile && !profile.is_a?(Integer)

0 commit comments

Comments
 (0)