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

Commit f0d7b27

Browse files
authored
Merge pull request #2873 from rspec/clarify-pending-main
Clarify pending docs
2 parents a5bf456 + ea829a1 commit f0d7b27

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

lib/rspec/core/pending.rb

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class PendingExampleFixedError < StandardError; end
3838
# @param message [String] optional message to add to the summary report.
3939
#
4040
# @example
41-
# describe "an example" do
41+
# describe "some behaviour" do
4242
# # reported as "Pending: no reason given"
4343
# it "is pending with no message" do
4444
# pending
@@ -52,21 +52,13 @@ class PendingExampleFixedError < StandardError; end
5252
# end
5353
# end
5454
#
55-
# @note `before(:example)` hooks are eval'd when you use the `pending`
56-
# method within an example. If you want to declare an example `pending`
57-
# and bypass the `before` hooks as well, you can pass `:pending => true`
58-
# to the `it` method:
59-
#
60-
# it "does something", :pending => true do
61-
# # ...
62-
# end
63-
#
64-
# or pass `:pending => "something else getting finished"` to add a
65-
# message to the summary report:
66-
#
67-
# it "does something", :pending => "something else getting finished" do
68-
# # ...
69-
# end
55+
# @note When using `pending` inside an example body using this method
56+
# hooks, such as `before(:example)`, have already be run. This means that
57+
# a failure from the code in the `before` hook will prevent the example
58+
# from being considered pending, as the example body would not be
59+
# executed. If you need to consider hooks as pending as well you can use
60+
# the pending metadata as an alternative, e.g.
61+
# `it "does something", pending: "message"`.
7062
def pending(message=nil)
7163
current_example = RSpec.current_example
7264

0 commit comments

Comments
 (0)