# Odd behaviour using RSpec from Rakefile

**URL:** <https://www.ruby-forum.com/t/odd-behaviour-using-rspec-from-rakefile/127016>\
**Category:** Ruby\
**Created:** [January 24, 2008, 7:41am UTC](https://www.ruby-forum.com/t/odd-behaviour-using-rspec-from-rakefile/127016 "2008-01-24T07:41:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Clifford\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/49beb7/32.png) [@Clifford\_H](https://www.ruby-forum.com/u/Clifford_H)\
**Post date:** [January 24, 2008, 7:41am UTC](https://www.ruby-forum.com/t/odd-behaviour-using-rspec-from-rakefile/127016/1 "2008-01-24T07:41:47Z")

</div>

I’m using RSpec with rake, with specs in the “spec” directory,  
and the SpecTask is called :test.

When I run “rake test”, the ARGV from rake gets picked up by  
the RSpec option parser, which adds it (in option\_parser.rb:123)  
to the @files list. That means that later, rspec decides that  
there should be a directory called “test”, and an exception is  
thrown from spec/runner/options.rb:216, in files\_to\_load.

I don’t know what the expected behaviour is here, but I know that  
this isn’t it! It seems that RSpec shouldn’t be using ARGV here,  
since rake, not rspec, is the main program.

Can someone please comment on the correct way to fix this?

Clifford H…

---

<div class="post-metadata">

**Author:** ![Clifford\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/49beb7/32.png) [@Clifford\_H](https://www.ruby-forum.com/u/Clifford_H)\
**Post date:** [January 24, 2008, 3:54pm UTC](https://www.ruby-forum.com/t/odd-behaviour-using-rspec-from-rakefile/127016/2 "2008-01-24T15:54:33Z")

</div>

On Jan 24, 2008 12:39 AM, Clifford H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> this isn’t it! It seems that RSpec shouldn’t be using ARGV here,  
> since rake, not rspec, is the main program.
> 
> Can someone please comment on the correct way to fix this?

The best way to get things fixed in RSpec is to enter a ticket in  
RSpec’s tracker at [http://rspec.lighthouseapp.com](http://rspec.lighthouseapp.com).

Cheers,  
David
