[rspec-devel] running only a select group of specs

Pat Maddox pergesu at gmail.com
Wed Aug 20 01:00:26 EDT 2008

On Tue, Aug 19, 2008 at 11:54 PM, Scott Taylor
<mailing_lists at railsnewbie.com> wrote:
> On Aug 19, 2008, at 8:46 PM, Pat Maddox wrote:
>> On Tue, Aug 19, 2008 at 8:38 PM, Ben Mabey <ben at benmabey.com> wrote:
>>> I know the easy thing would be to just create separate unit and
>>> functional directories.. but that is something that I would like to
>>> avoid.  Besides, that is easy and I like pain. :)
>> Why do you want to avoid that?  I think it's superior from an
>> organizational standpoint, and doesn't require screwing with the
>> runner.
> Well, it does seem like you'd need to screw with the running just a little
> bit if you plan spec/integrationmodels and spec/unit/models to use the
> ModelExampleGroup, and so on...

Right now, what happens is the example group factory looks at the path
to the spec and sees if it matches some known type.  For example, it


and parses out models.  Then it looks to see if it knows of an example
group type registered to the key :model.  So if you follow a naming
structure like


then it'll still work fine.  Moving them around will not work though:

I don't know whether or not it's desirable to make it work
automatically for this other dir structure (which makes more sense in
my eyes anyway).  At any rate, the approach I've used is to have a
spec_helper.rb in that file that sets the default example group class.
 So spec/unit/models/spec_helper.rb has


So while you're right that you do have to do something in order to
make it work, there is at least a reasonable, official way of doing


More information about the rspec-devel mailing list