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

Clarify pending docs #2873

Merged
merged 1 commit into from
Feb 26, 2021
Merged
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
24 changes: 8 additions & 16 deletions lib/rspec/core/pending.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class PendingExampleFixedError < StandardError; end
# @param message [String] optional message to add to the summary report.
#
# @example
# describe "an example" do
# describe "some behaviour" do
# # reported as "Pending: no reason given"
# it "is pending with no message" do
# pending
Expand All @@ -52,21 +52,13 @@ class PendingExampleFixedError < StandardError; end
# end
# end
#
# @note `before(:example)` hooks are eval'd when you use the `pending`
# method within an example. If you want to declare an example `pending`
# and bypass the `before` hooks as well, you can pass `:pending => true`
# to the `it` method:
#
# it "does something", :pending => true do
# # ...
# end
#
# or pass `:pending => "something else getting finished"` to add a
# message to the summary report:
#
# it "does something", :pending => "something else getting finished" do
# # ...
# end
# @note When using `pending` inside an example body using this method
# hooks, such as `before(:example)`, have already be run. This means that
# a failure from the code in the `before` hook will prevent the example
# from being considered pending, as the example body would not be
# executed. If you need to consider hooks as pending as well you can use
# the pending metadata as an alternative, e.g.
# `it "does something", pending: "message"`.
def pending(message=nil)
current_example = RSpec.current_example

Expand Down