Skip to content
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

Fix predicates to return actual true/false values #2756

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/rspec/core/example.rb
Expand Up @@ -232,7 +232,10 @@ def example_group
end

alias_method :pending?, :pending
alias_method :skipped?, :skip

def skipped?
!!skip
end
JonRowe marked this conversation as resolved.
Show resolved Hide resolved

# @api private
# instance_execs the block passed to the constructor in the context of
Expand Down Expand Up @@ -579,6 +582,10 @@ class ExecutionResult

alias pending_fixed? pending_fixed

def initialize
@pending_fixed = false
end
JonRowe marked this conversation as resolved.
Show resolved Hide resolved

# @return [Boolean] Indicates if the example was completely skipped
# (typically done via `:skip` metadata or the `skip` method). Skipped examples
# will have a `:pending` result. A `:pending` result can also come from examples
Expand Down
3 changes: 3 additions & 0 deletions spec/spec_helper.rb
Expand Up @@ -87,6 +87,9 @@ def handle_current_dir_change
c.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
expectations.max_formatted_output_length = 1000
if expectations.respond_to? :strict_predicate_matchers=
expectations.strict_predicate_matchers = true
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can skip that, and add separately when rspec/rspec-expectations#1196 is merged. Otherwise, we'll have to remove the check later on anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a chicken and egg problem. Without this, rspec/rspec-expectations#1196 will break the build as it introduces changes in the failure messages in this spec suite.

end

c.mock_with :rspec do |mocks|
Expand Down