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

Commit 41ab9a7

Browse files
committed
Justify pending behaviour with mocks expectations.
1 parent 1499876 commit 41ab9a7

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

lib/rspec/core/pending.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def self.mark_pending!(example, message_or_bool)
132132

133133
def self.mark_fixed!(example)
134134
example.metadata[:pending] = false
135-
example.execution_result[:pending_fixed] = true
135+
example.metadata[:execution_result][:pending_fixed] = true
136136
end
137137

138138
def self.guarded?(*args)

spec/rspec/core/pending_example_spec.rb

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,20 @@ def run_example(*pending_args)
207207
super(*pending_args) { expect("foo").to receive(:bar) }
208208
end
209209

210-
it 'passes' do
211-
pending 'need to figure out a way to do this'
212-
expect(run_example("just because")).to_not be_pending
210+
it 'is pending' do
211+
# This behaviour appears inconsistent. You would expect this to
212+
# pass, since the pending block is "failing". It is problematic though
213+
# because the failure is not actually present until the end of the
214+
# example.
215+
#
216+
# There may be a solution here where the example is a run a second time
217+
# treating pending blocks as skipped, but I haven't thought it through
218+
# and seems probably more complex than it's worth. It's not clear to me
219+
# what "expected behaviour" should even be.
220+
#
221+
# The fallback behaviour of always flagging the example pending doesn't
222+
# seem so bad.
223+
expect(run_example("just because")).to be_pending
213224
end
214225
end
215226

0 commit comments

Comments
 (0)