Auto-fail a spec with no assertions

19 views
Skip to first unread message

Dan Bernier

unread,
Feb 18, 2014, 9:30:34 AM2/18/14
to rs...@googlegroups.com
Could a spec with no expectations automatically pend, or fail? possibly controlled via a flag?

    it 'should have muffins'
      baker.has_muffins?    # <- a quick scan makes this look right
      expect(baker.has_muffins?).to be_true  # <- but you need this
    end

    $ rspec   # The empty spec passes
    $ rspec --fail-empty-specs   # The empty spec fails
    $ rspec --pend-empty-specs  # The empty spec pends

In an ideal world, this would be unneeded. But when you work on a large code base, and you're interrupted, it's pretty easy to make this mistake.

--

Myron Marston

unread,
Feb 18, 2014, 10:56:08 AM2/18/14
to rs...@googlegroups.com
This has been discussed several times before:


I just reopened #759 as I'm more onboard with adding this than before.  Let's continue discussion there.

BTW, here's a way you can get this now:


Myron
Reply all
Reply to author
Forward
0 new messages