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

Commit d10afaa

Browse files
committed
Change the pending with block error message
We used to mention RSpec 2 there which is long gone. Also, this note was misleading: > If you want to declare an example `pending` and bypass the `before` hooks as well, you can pass `:pending => true` In the following spec: RSpec.describe do before { puts 'before!' } it do pending 'oops' fail 'djosdkfjos' end it 'pending metadata', pending: true do fail 'dferrerere' end end the hook is run for both metadata and in-example `pending`: before! pending metadata (PENDING: No reason given) before! example at ./spec/a_spec.rb:4 (PENDING: oops)
1 parent 93aec30 commit d10afaa

File tree

3 files changed

+3
-27
lines changed

3 files changed

+3
-27
lines changed

lib/rspec/core/pending.rb

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -51,36 +51,12 @@ class PendingExampleFixedError < StandardError; end
5151
# raise "broken"
5252
# end
5353
# end
54-
#
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
7054
def pending(message=nil)
7155
current_example = RSpec.current_example
7256

7357
if block_given?
7458
raise ArgumentError, <<-EOS.gsub(/^\s+\|/, '')
75-
|The semantics of `RSpec::Core::Pending#pending` have changed in
76-
|RSpec 3. In RSpec 2.x, it caused the example to be skipped. In
77-
|RSpec 3, the rest of the example is still run but is expected to
78-
|fail, and will be marked as a failure (rather than as pending) if
79-
|the example passes.
80-
|
81-
|Passing a block within an example is now deprecated. Marking the
82-
|example as pending provides the same behavior in RSpec 3 which was
83-
|provided only by the block in RSpec 2.x.
59+
|Passing a block within an example is not supported.
8460
|
8561
|Move the code in the block provided to `pending` into the rest of
8662
|the example body.

spec/rspec/core/example_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ def expect_pending_result(example)
744744
group.run
745745
expect(example).to fail_with ArgumentError
746746
expect(example.exception.message).to match(
747-
/Passing a block within an example is now deprecated./
747+
/Passing a block within an example is not supported./
748748
)
749749
end
750750
end

spec/rspec/core/pending_example_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@
200200
group.run
201201
expect(example).to fail_with ArgumentError
202202
expect(example.exception.message).to match(
203-
/Passing a block within an example is now deprecated./
203+
/Passing a block within an example is not supported./
204204
)
205205
end
206206

0 commit comments

Comments
 (0)