Disabling Groups of RSpec Examples

During the process of updating the code, I thought it might be better to have a test suite that more closely matches our production code. I wanted the rspec command to be inclusive of all features in the production environment, but I didn’t want to remove the specs not being used since we may implement those features later.

I found that trying to mark each test as pending individually would be tedious when my production environment may exclude an entire controller. When searching for a way to ignore an entire describe block, I came across exclusion filters.

By configuring a tag to be excluded in the configuration file, we can then tag an entire describe block to be omitted from the tests. My spec_helper file now includes:

RSpec.configure do |config|
  config.filter_run_excluding :disabled => true

And now I can use the disabled tag like this to disable every test in a describe block:

describe "SessionsController", disabled: true do

Check out all the code over at the ToSBack3 Github page!

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>