← Back to Upcase

Rspec example failure without expectation

Occasionally, an example will have an omitted expectation. This could happen from a hairy git merge, or just plain distraction. Is there anyway to configure Rspec to fail the example if there is no expectation?

1 Like

If something like this doesn’t exist, it might be an awesome PR candidate for RSpec.

Related note:
I really like the skip/pending functionality in RSpec now, where pending specs that don’t fail within it blocks produce test failures.

Looks like it’s been talked about long ago here: https://github.com/rspec/rspec-core/issues/404

The consensus seemed to be that it would cause too much coupling between the rspec-core and rspec-expectations libraries. myronmarston put together an example of how something like this could work, but it’s pretty old and doesn’t seem to anymore.