[rspec-users] tags and spec_helper

Matt Wynne matt at mattwynne.net
Fri Jun 24 12:55:07 EDT 2011

I've been trying to separate out some fast specs in a Rails app in a Gary Bernhardt style[1], and I experimented with using tags.

The problem with using tags is that in order to scan the specs for examples that match the tags, it loads every spec file, most of which require spec_helper, which loads Rails, and so takes 5-6 seconds. Thereby totally defeating the original purpose.

One idea I have is to put some if statements into spec_helper to check the tags that were passed to RSpec and only load the rails env if necessary. Is that possible?

Has anyone else tried doing anything like this?


matt at mattwynne.net
07974 430184

[1] https://www.destroyallsoftware.com/screencasts/catalog/fast-tests-with-and-without-rails

More information about the rspec-users mailing list