Subscribed unsubscribe Subscribe Subscribe

Kentaro Kuribayashi's blog

Software Engineering, Management, Books, and Daily Journal.

Use `pending` with Time Limit

@sora_h made a tool named pendax which is to urge people to fix pending examples. It's totally right that we shouldn't use pending in specs in the first place, but pendings are needed some time for some reason.

@tokuhirom suggested to use pending with obvious time limit for that case. pending takes if/unless options (document). We can use it to indicate that time limit:

require 'rspec'

describe 'pending' do
  it 'should be in status, pending' do
    pending 'pending'
    expect(nil).to be_true

  it 'should not be in status, pending' do
    pending "I'll definitely fix this!!1", if: < Time.local(2012, 10, 31)
    expect(nil).to be_true