Running Autotest with Rspec gem 0

Posted by tohchye

Recently I have decided to use the gem version of rspec instead of the plugin version. When I tried run autotest within the project root folder I got the following error.

script/spec:3:in `require': no such file to load  spec (LoadError)
        from script/spec:3

The error was caused by line 3 of file script/spec.


1 #!/usr/bin/env ruby
2 $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../vendor/plugins/rspec/lib"))
3 require 'spec'
4 exit ::Spec::Runner::CommandLine.run(::Spec::Runner::OptionParser.parse(ARGV, STDERR, STDOUT))

It’s trying to load spec file from the project plugins directory which is not available. To fix this problem just change the second line of the code to:


1 #!/usr/bin/env ruby
2 require 'rubygems'
3 require 'spec'
4 exit ::Spec::Runner::CommandLine.run(::Spec::Runner::OptionParser.parse(ARGV, STDERR, STDOUT))

Then start autotest from the project root directory and it should now run without errors.