[rspec-users] rspec, rspec-rails 1.1.99-12 and script/spec 'no such file to load -- spec'

David Chelimsky dchelimsky at gmail.com
Sat Mar 7 11:53:56 EST 2009


On Sat, Mar 7, 2009 at 8:50 AM, David Chelimsky <dchelimsky at gmail.com> wrote:
> On Fri, Mar 6, 2009 at 4:02 PM, rockrep <rockrep at gmail.com> wrote:
>> Hi David, all:
>>
>> I just recently upgraded to Rails 2.3.1RC2 (Mac OS.X 10.5.6, ruby
>> 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9])  and have been
>> dilligently following the instructions for upgrading rspec and rspec-
>> rails according to:  http://wiki.github.com/dchelimsky/rspec/rails-with-rspec-gems.
>> I have successfully built the rspec and rspec-rails gems, installed
>> and unpacked them, and ran script/generate rspec successfully.
>>
>> 'rake spec' works fine, however 'script/spec' fails with error:
>> $ script/spec spec
>> script/spec:3:in `require': no such file to load -- spec (LoadError)
>>
>> script/spec looks like:
>> #!/usr/bin/env ruby
>> $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../
>> vendor/plugins/rspec/lib"))
>
> This bit is a bug that I plan to fix (today), but that's not the only
> problem here.

This fixed and pushed to github

http://github.com/dchelimsky/rspec-rails/commit/cd15dd5cbd6ca9cf2cd2f8ae873e0a8901e84662

>
>> require 'spec'
>> exit ::Spec::Runner::CommandLine.run
>>
>> and 'rake gems RAILS_ENV=test' returns:
>>  - [R] rspec >= 1.1.99.12
>>  - [F] rspec-rails >= 1.1.99.12
>>    - [R] rspec = 1.1.99.12
>>    - [F] rack = 0.9.1
>>    - [ ] cucumber >= 0.1.13
>>    - [ ] hoe >= 1.9.0

Just an FYI about the listed dependencies - cucumber and hoe are
developer dependencies of rspec, so you don't need them to run rspec.
It looks like rails gem management system doesn't make that
distinction, and shows all dependencies regardless of type.

>>
>> I = Installed
>> F = Frozen
>> R = Framework (loaded before rails starts)
>>
>> rspec does not exist in vendor/gems, but rspec-rails does.  It seems
>> it's marked as 'R' which (1) I'm not certain I understand why, and (2)
>> seems to prevent unpacking into vendor/gems.   In any case, I would
>> like to resolve the issue with script/spec.
>
> I've seen this with older versions of lib/tasks/rspec.rake that
> required 'spec'. Basically, when you run any rake task in rails, rake
> loads up the Rakefile in the project root *and* all of the .rake files
> in lib/tasks before executing anything. So if any of those files
> require 'spec', then the rails/gems framework will consider rspec to
> be loaded already, and won't let you unpack it.
>
> Try this:
>
> rm lib/tasks/rspec.rake
> rake gems RAILS_ENV='test'
>
> If that changes rspec to [I], then you can unpack it and you should be
> good to go.
>
>>
>> Since rspec is also not installed in vendor/plugins the LOAD_PATH line
>> in script/spec looks odd, but I'm not sure it's the cause.
>>
>> Any pointers greatly appreciated.  Thanks,
>>
>> Michael
>>
>> _______________________________________________
>> rspec-users mailing list
>> rspec-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
>>
>


More information about the rspec-users mailing list