New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strict predicate #1196
Strict predicate #1196
Conversation
57247ea
to
750ed10
Compare
Converted to draft as it requires pre-requisite PRs to be approved/merged first. |
750ed10
to
b777f06
Compare
b777f06
to
e8bbfe1
Compare
Rebased. CI errors are due to issues in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incredible! Thank you.
e8bbfe1
to
f6091b5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good, a few nitpicks / suggestions, including a bike shed which I apologise for but I'd rather obey the rubocop rules as they stand and change them later if people want to.
lib/rspec/matchers/built_in/has.rb
Outdated
@@ -90,8 +90,12 @@ def predicate_method_name | |||
predicate | |||
end | |||
|
|||
def predicate_matches? | |||
!!predicate_result | |||
def predicate_matches?(value = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the space around the =
here, theres a rubocop rule enforcing no spaces, which I personally disagree with but its failing currently. (Ping @pirj, happy to change the rule but not in this PR).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still needs fixing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, forgot to amend my commit. Done
2b069e4
to
9f23d77
Compare
Should be all fixed. |
9f23d77
to
441fa94
Compare
@@ -185,6 +186,21 @@ def on_potential_false_positives=(behavior) | |||
@on_potential_false_positives = behavior | |||
end | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This extra blank line is failing rubocop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I'm sorry about that. Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there, looks like the core build is fixed (on those Rubies that don't run Rubocop) but there is still a rubocop violation that needs fixing (sorry!)
441fa94
to
693ce55
Compare
Thank you @JonRowe ❤️ |
Thank you, @marcandre ! |
Yes thank you @marcandre and thank you for your patience 😂 |
Will it be possible to make a release? |
I'm aiming to find some time this week to release |
@JonRowe Any hope for a release? |
A release was being prepared but is currently blocked by #1221, that needs a fix before a minor can be shipped. |
Released as |
Awesome @JonRowe thanks for letting me know 🎉 |
* Remove outdated option rspec/rspec-core@0407831 * Use the non-globally exposed RSpec syntax rspec/rspec-core#2803 * Use the non-globally exposed RSpec syntax, cont rspec/rspec-core#2803 * Comply to strict predicate matchers See: - rspec/rspec-expectations#1195 - rspec/rspec-expectations#1196 - rspec/rspec-expectations#1277
This PR adds a config setting
strict_predicate_matchers
which makes the checks for the dynamic predicate matchers strict. Default isfalse
but for internal specs the setting is changed totrue
inspec_helper
.It changes the failure messages in the non-strict case from "expected ... to return true/false, ..." to "expected ... to be truthy/falsey, ...".
It builds on #1195