Tags/categories for specs

Many thanks to David C. for answering my question about :type &
:behaviour_type hash key:

http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/4b76e2c5a1a8918d

It has made me curious to know whether tagging specs is a feature anyone
has
requested before.

The current project i’m working on has a vast number of specs - most
using
selenium - and consequently a very long build (cruisecontrol).

We have a few of different independant streams of development, all
working
on the same codebase, each having an associated ‘precheckin’ build. We
try
to make sure these only take up to 10-15 mins by running a relevant
subset
of the specs. We’d ideally run the full build locally before every
commit
but we optimistically commit when the relevant precheckin build passes
just
so we can check in more frequently (the build server always runs the
full
build). There’s effort going into reduing the overall build time
(selenium
grid and various other ideas) but this is a reasonable option right now.

Currently we achieve this crudely by having a custom spec runner that
loads
specs according to whether the filename matches a set of inclusion
regular
expressions and doesn’t match a set of exclusion regular expressions
(each
stream has a set of filters). A simpler method might have just been to
put
the specs in different directories but it’s convenient to be able to
include
the same spec in more than one of these precheckin builds.

It would be really cool to have just been able to write specs like this:

describe ‘some piece of functionality’, :tags => [:ui, :search] do

end

describe ‘some other piece of functionality’, :tags => [:ui] do

end

and then execute only the first spec as a result of launching something
like
‘spec --tags search’ - all of the specs can be loaded but only those
that
match the specified tag would be executed.

Having poked around the code a little, it doesn’t seem impossibly
difficult
to implement.

Does the idea have any appeal to anyone? It doesn’t seem an especially
original idea so I wonder if anyone has already had a go at implementing
it?

Mark.

On Thu, Apr 3, 2008 at 5:48 AM, Mark R. [email protected] wrote:

Many thanks to David C. for answering my question about :type &
:behaviour_type hash key:

http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/4b76e2c5a1a8918d

It has made me curious to know whether tagging specs is a feature anyone has
requested before.

I’ve heard this mentioned a couple times before. I don’t think I’ve
ever heard arguments against it…probably just that it’s never itched
bad enough for someone to scratch it.

You should search the ticket tracking system
(http://rspec.lighthouseapp.com/projects/5645-rspec/overview) for
anything like that, and submit a feature request if you don’t find
anything.

Ooh, a patch would be good too :slight_smile:

Pat

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs