[rspec-devel] spec.opts

David Chelimsky dchelimsky at gmail.com
Mon Aug 25 17:41:03 EDT 2008


On Mon, Aug 25, 2008 at 2:28 PM, Yehuda Katz <wycats at gmail.com> wrote:
> Sure... if you want to do stuff like:
>
> require File.expand_path(File.join(File.dirname(__FILE__), "..",
> "spec_helper")))
>
> This is super-unDRY and I'd like to be able to have this happen
> automatically without having to do spec -O spec/spec.opts ...
>
> Is there a reason not to try and find spec/spec.opts and load it
> automatically?
>

I don't object to looking for spec/spec.opts. My only concern is that
if you are sitting in a different directory it won't get picked up
(unless we start traversing up the path, something I would strongly
object to), so you won't always get the same results unless you always
work from the same directory, which would lead to its own brand of
confusion.

What if we were to add an rspec_options method (or similar) that you
could wrap around the contents of spec_helper.rb:

rspec_options do
  ...
end

This could ensure that even if the file is loaded more than once, it
is only processed once.

> -- Yehuda
>
> On Mon, Aug 25, 2008 at 12:22 PM, Pat Maddox <pergesu at gmail.com> wrote:
>>
>> On Mon, Aug 25, 2008 at 2:41 PM, Yehuda Katz <wycats at gmail.com> wrote:
>> > I spoke to dchelimsky this morning and am bringing our conversation to
>> > the
>> > list.
>> >
>> > Effectively, I asked why we don't automatically require spec/spec.opts
>> > (which I wanted in order to be able to yank require 'spec_helper' from
>> > my
>> > specs, because require 'spec_helper' and require '../spec_helper'
>> > results in
>> > two requires, which sucks).
>>
>> Doesn't File.expand_path solve this issue?
>>
>> Pat
>> _______________________________________________
>> rspec-devel mailing list
>> rspec-devel at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-devel
>
>
>
> --
> Yehuda Katz
> Developer | Engine Yard
> (ph) 718.877.1325
>
> _______________________________________________
> rspec-devel mailing list
> rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel
>


More information about the rspec-devel mailing list