On Aug 08, 2010, at 2:17 am, Phillip K. wrote:
I have developed a system in which I require model_helper.rb in model specs, controller_helper.rb in controllers, and (you guessed it!) view_helper.rb in view specs. Each of those then require spec_helper.rb. I did this because I wanted fine-grained control over what gets loaded when, which started when I decided I wanted to use Remarkable for model specs only and didn’t want it available during other specs. Plus, I keep customizations out of spec_helper.rb, which is a very good thing.
I think the way I worded by question may have made it sound like I was
expecting everyone using TextMate to use put “require ‘spec_helper’” at
the top of the file… I didn’t mean that! I was just suggesting that
if a file starts with that require, then TextMate should see it as an
RSpec file. As you’ve pointed out, this won’t get all files, like your
custom helpers. But I imagine it’d get a fairly high proportion.
This is probably like trying to swat a fly with Mack truck, but what if all files under spec/ were considered RSpec files? Or possibly some variation of that?
I just double checked, and spec_helper.rb isn’t considered an RSpec file
- and actually, I don’t think it should be. Also, I have a spec/support
folder in most projects, with matchers etc. They aren’t RSpec files
either. So this route would probably give a lot of false positives.
It might work better if this was the default folder structure:
Then you could glob everything under “examples”. I actually do this
with Cucumber, where my folder structure is:
But apparently I’m alone in the world not wanting to mix .feature files
in with the support folder!
Either way, I’m not convinced using the folder structure is the best
solution. It forces TextMate users to structure there project a certain
way. If you wanted a rails app like this:
(or whatever) then path matching wouldn’t work.
On Aug 07, 2010, at 11:44 pm, David C. wrote:
I think it’s good to do things that help end users, but we’d need a more reliable convention to base this on. Anybody (including Ashley) got any other suggestions?
Actually, I’m stuck :-/ I didn’t think it’d be hard to identify RSpec
example group files! I’m not much of a TextMate developer though.
Anyone else got ideas?