Marcus Ahnve
2010-Feb-21 20:57 UTC
[rspec-users] Problem running spec command for directory
Hi, I have a problem running the spec command in Rspec 1.3.0 with a directory as parameter. A spec for a MongoMapper document that works when run directly such as $ spec spec/model/attendant_spec.rb works fine. But the very same spec run glob-style: $ spec spec fails with MongoMapper validations seemingly added twice - full output at http://pastie.org/835775. According to the stack trace files seems to be required in the same order as when run individually, but clearly something else is messed up. Is there something one should know about when running specs by glob? Thanks for any help /Marcus -- Marcus Ahnve http://marcus.ahnve.net phone: +46 8 56 22 33 94 twitter: mahnve
David Chelimsky
2010-Feb-21 21:14 UTC
[rspec-users] Problem running spec command for directory
On Sun, Feb 21, 2010 at 2:57 PM, Marcus Ahnve <marcus at ahnve.com> wrote:> Hi, > > I have a problem running the spec command in Rspec 1.3.0 with a > directory as parameter. > > A spec for a MongoMapper document that works when run directly such as > > $ spec spec/model/attendant_spec.rb > > works fine. But the very same spec run glob-style: > > $ spec spec > > fails with MongoMapper validations seemingly added twice - full output > at http://pastie.org/835775. > > According to the stack trace files seems to be required in the same > order as when run individually, but clearly something else is messed > up. > > Is there something one should know about when running specs by glob? > > Thanks for any help /MarcusLooks like there are a bunch of relative paths in the stack trace - like this: from /home/mahnve/src/agilasverige/app/agilasverige/spec/model/../spec_helper.rb This means that files may be reloaded depending on where they''re ref''d from. Rspec adds ./lib and ./spec to the $LOAD_PATH, so you should be able to require things directly. For example: require "spec_helper" ... will require ./spec/spec_helper.rb. HTH, David> > -- > Marcus Ahnve > http://marcus.ahnve.net > phone: +46 8 56 22 33 94 > twitter: mahnve > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Marcus Ahnve
2010-Feb-24 15:51 UTC
[rspec-users] Problem running spec command for directory
On Sun, Feb 21, 2010 at 03:14:10PM -0600, David Chelimsky wrote:> On Sun, Feb 21, 2010 at 2:57 PM, Marcus Ahnve <marcus at ahnve.com> wrote: > > Hi, > > > > I have a problem running the spec command in Rspec 1.3.0 with a > > directory as parameter. > > > > A spec for a MongoMapper document that works when run directly such as > > > > $ spec spec/model/attendant_spec.rb > > > > works fine. But the very same spec run glob-style: > > > > $ spec spec > > > > fails with MongoMapper validations seemingly added twice - full output > > at http://pastie.org/835775. > > > > According to the stack trace files seems to be required in the same > > order as when run individually, but clearly something else is messed > > up. > > > > Is there something one should know about when running specs by glob? > > > > Thanks for any help /Marcus > > Looks like there are a bunch of relative paths in the stack trace - like this: > > from /home/mahnve/src/agilasverige/app/agilasverige/spec/model/../spec_helper.rb > > This means that files may be reloaded depending on where they''re ref''d from. > > Rspec adds ./lib and ./spec to the $LOAD_PATH, so you should be able > to require things directly. For example: > > require "spec_helper" > > ... will require ./spec/spec_helper.rb. > > HTH, > DavidIt was indeed a relative path that was the culprit. Thanks for the help. Cheers /Marcus -- Marcus Ahnve http://marcus.ahnve.net phone: +46 8 56 22 33 94 twitter: mahnve