Mark Test Pending With xit
Mark any RSpec test temporarily pending by changing it
or specify
to xit.
Take this test, from the 'Today I Learned' codebase:
# spec/models/channel_spec.rb
describe Channel do
it 'should have a valid factory' do
channel = FactoryGirl.build(:channel)
expect(channel).to be_valid
end
end
Change it to this:
# spec/models/channel_spec.rb
describe Channel do
xit 'should have a valid factory' do
channel = FactoryGirl.build(:channel)
expect(channel).to be_valid
end
end
Here's the test output:
$ rspec spec/models/channel_spec.rb:4
Run options: include {:locations=>{"./spec/models/channel_spec.rb"=>[4]}}
Channel
should have a valid factory (PENDING: Temporarily skipped with xit)
...
Use this when refactoring code that breaks tests, to avoid deleting or commenting-out that hard-won test logic while you get back to green, test by test.
h/t Dorian Karter
Tweet