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

Commit c9e41f1

Browse files
committed
fixup! Clarify difference in pending usage
1 parent c7d5bc6 commit c9e41f1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lib/rspec/core/pending.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,23 @@ class PendingExampleFixedError < StandardError; end
7171
# it "does something", :pending do
7272
# # ...
7373
# end
74+
#
75+
# @note There is a difference between using `pending` inside the example
76+
# body and `pending` example group alias/`pending` metadata. In the case
77+
# when the failure is caused by the code in the `before` hook, the example
78+
# would not be considered pending, as the example body wouldn't be reached.
79+
# If you intend the failure in the `before` hook to be considered a part
80+
# of the example, use the latter.
81+
#
82+
# @example Failure in `before` hook causes the example to fail
83+
# before { fail 'BOOM' }
84+
# it 'fails' do
85+
# pending 'this never gets executed'
86+
# end
87+
#
88+
# pending 'is considered pending' do
89+
# not_implemented
90+
# end
7491
def pending(message=nil)
7592
current_example = RSpec.current_example
7693

0 commit comments

Comments
 (0)