Let's say I have a bunch of tests:
spec/code_spec.rb
:
require "rails_helper"
RSpec.describe Code do
xit { Code.evaluate("Twitter.search") }
xit { Code.evaluate("Slack.send") }
xit { Code.evaluate("Twitter.send") }
end
I get:
~/s/d/code> rspec spec/code_spec.rb
Randomized with seed 54828
Code
example at ./spec/code_spec.rb:5 (PENDING: Temporarily skipped with xit)
example at ./spec/code_spec.rb:6 (PENDING: Temporarily skipped with xit)
example at ./spec/code_spec.rb:4 (PENDING: Temporarily skipped with xit)
Pending: (Failures listed here are expected and do not affect your suite's status)
1) Code
# Temporarily skipped with xit
# ./spec/code_spec.rb:5
2) Code
# Temporarily skipped with xit
# ./spec/code_spec.rb:6
3) Code
# Temporarily skipped with xit
# ./spec/code_spec.rb:4
Finished in 0.00251 seconds (files took 3.32 seconds to load)
3 examples, 0 failures, 3 pending
Randomized with seed 54828
What I would like is rspec to execute the tests and fail if they pass, ideally telling me I need to unskip them.
Is it possible?
You can add pending: 'pending reason'
to test description
everything is described here https://www.joshmcarthur.com/til/2019/05/27/pending-block-examples-with-rspec.html
this test will be run by rspec, but will not fail whole test suite
it 'adds 1 + 1 and equals 3', pending: true do
expect(1 + 1).to eq 3
end
but this test will fail, because no error was raised
it 'adds 1 + 1 and equals 2', pending: true do
expect(1 + 1).to eq 2
end