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

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/rspec/core/example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,10 @@ def example_group
end

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

def skipped?
!!skip
end

# @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

# @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
Original file line number Diff line number Diff line change
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