[rspec-users] Reason for _spec.rb convention
Ashley Moran
work at ashleymoran.me.uk
Mon Sep 3 09:36:34 EDT 2007
On 3 Sep 2007, at 13:47, Wincent Colaiuta wrote:
> I know it's very application-specific, but one good reason for this
> is that it makes finding files in TextMate much easier when you hit
> Command-T; you type a few characters and at a glance can distinguish
> between spec and implementation files.
This makes sense! However, after a bit of testing, it turns out
TextMate identifies the shortest unique path, so if you have
address.rb in app/models and spec/models, it displays this in the Cmd-
T window:
address.rb – app/models
address.rb – spec/models
TextMate's interface never ceases to amaze me.
I suppose also you could set up a spec runner to skip files not
ending _spec.rb in case you wanted support code in the spec folders
(not sure if this is a good idea in practice or not, just occurred to
me).
On 3 Sep 2007, at 13:50, Scott Taylor wrote:
> Personally, I think the only reason we keep it around is for
> Autotest, which maps xyz_spec.rb => xyz.rb. But - Feel free to name
> your specs however you choose.
Not used Autotest - I'm sure it could be made to map xyz.rb => xyz.rb
too though.
This satisfied my curiosity anyway - someone mentioned it on nitro-
general and I realised I didn't know where _spec came from.
Thanks
Ashley
More information about the rspec-users
mailing list