[rspec-users] Recognising RSpec files in the Textmate bundle
phillipkoebbe at gmail.com
Sat Aug 7 21:17:36 EDT 2010
On 2010-08-07 5:44 PM, David Chelimsky wrote:
> On Aug 7, 2010, at 5:28 PM, Ashley Moran wrote:
>> Did the RSpec TMBundle ever have multiple ways of recognising RSpec files? I'm convinced it user to look for "spec_helper" on the first line.
> I'm pretty sure it never did that.
>> The Ruby bundle does something similar, as it looks for "firstLineMatch = '^#!/.*\bruby';"
>> The reason I ask is because I now have several files that end "_contract.rb". Conceivably I might have other shared example files with different suffices. But it's fairly safe to say they will all start with "require 'spec_helper'".
> I can't think of a case in which I've required spec_helper from a file that defines shared groups. So in my case, that is not safe to say :)
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 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?
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?
More information about the rspec-users