Error on custom_require.rb when rspec executed.

Hello all,

I'm bekkou68.
I have a error on custom_require.rb, which occurred when I execute
rspec.

I executed the following command.
$ script/spec spec/models/

Then, I got the following result.
# /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require': no such file to load -- application
(MissingSourceFile)
# from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:
31:in `require'
# from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/dependencies.rb:158:in `require'
# from /home/project/vendor/plugins/rspec_on_rails/lib/spec/
rails.rb:3
# from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:
31:in `gem_original_require'
# from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:
31:in `require'
# from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/dependencies.rb:158:in `require'
# from /home/project/spec/models/../spec_helper.rb:6
# from /home/project/spec/models/eng_word_spec.rb:1:in `require'
# from /home/project/spec/models/eng_word_spec.rb:1
# from /home/project/vendor/plugins/rspec/lib/spec/runner/
example_group_runner.rb:14:in `load'
# from /home/project/vendor/plugins/rspec/lib/spec/runner/
example_group_runner.rb:14:in `load_files'
# from /home/project/vendor/plugins/rspec/lib/spec/runner/
example_group_runner.rb:13:in `each'
# from /home/project/vendor/plugins/rspec/lib/spec/runner/
example_group_runner.rb:13:in `load_files'
# from /home/project/vendor/plugins/rspec/lib/spec/runner/
options.rb:85:in `run_examples'
# from /home/project/vendor/plugins/rspec/lib/spec/runner/
command_line.rb:19:in `run'
# from script/spec:4

Here is the contents of custom_require.rb.
# ============================== from here

The error is a couple steps back up the trace, in rspec's rails.rb.
The problem is that you're running an old version of rspec_on_rails,
which expects ApplicationController to be defined in app/controllers/
application.rb, which it isn't anymore. Upgrading to the new version
of rspec_on_rails will fix this.

--Matt Jones

Dear Mr.Matt,

Thanks for your message, and I'm sorry that I reply late.

Upgrading to the new version of rspec_on_rails will fix this.

I tried to update rspec with the following command.
$ ruby script/plugin install git://github.com/dchelimsky/rspec.git -r
'refs/tags/1.2.7' --force
$ ruby script/plugin install git://github.com/dchelimsky/rspec-rails.git
-r 'refs/tags/1.2.7.1' --force
$ ruby script/generate rspec
(http://wiki.github.com/dchelimsky/rspec/rails)

Then I can't execute spec,
$ script/spec -v
# script/spec:3:in `require': no such file to load -- spec (LoadError)
# from script/spec:3

The contents of spec is following,
$ more spec
# #!/usr/bin/env ruby
# $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../
vendor/plugins/rspec/lib"))
# require 'spec'

Now I can't solve this problem.
I'm happy when you help me.

Thanks,
bekkou68

rspec-rails 1.2.7.1 is surely working for me.
Your script/spec file seems like broken, though, I think you'd better
recreate your whole project and try again from scratch.
I recommend you not to edit the generated script/spec file unless
you're writing a patch for the RSpec project to fix a bug within
RSpec.

If you're not sticking on vendorizing plugins, config.gem feature
might be an easier way for you.
Put the following lines in your config/environments/test.rb file:

config.gem 'rspec', :lib => false, :version => '1.2.8'
config.gem 'rspec-rails', :lib => false, :version => '1.2.7.1'

and run:

% ruby script/generate rspec