Tuesday, June 17, 2008

Rspec 1.1.4 gem and plugin with Autotest

I love Rspec and Rspec-rails. Trying to get much better at it. Also love Autotest. Ryan Zenspider Davis is a prolific genius.

Had issues today with a new project running 1.1.4 with autotest. It was easily fixable though.

Here was the error:

############################################################################
Your RSpec on Rails plugin is incompatible with your installed RSpec.

RSpec : 20080615141040
RSpec on Rails : 20080526202855

Make sure your RSpec on Rails plugin is compatible with your RSpec gem.
See http://rspec.rubyforge.org/documentation/rails/install.html for details.
############################################################################
from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in'
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'
from /Users/holtonma/git/golfap/vendor/plugins/rspec-rails/lib/spec/rails.rb:15
from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in `require'
... 10 levels...
from /opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.4/lib/spec/runner/example_group_runner.rb:13:in `load_files'
from /opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.4/lib/spec/runner/options.rb:98:in `run_examples'
from /opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.4/lib/spec/runner/command_line.rb:19:in `run'
from script/spec:5
/opt/local/bin/ruby -S script/spec -O spec/spec.opts spec/models/player_spec.rb
Here was the fix:

"go into rspec-rails/lib/spec/rails/version.rb and comment the code that's complaining about the version mismatch. The risk is fairly low at this point that you're going to have any trouble."
http://www.ruby-forum.com/topic/156080

To get it working with Aututest, had to slightly modify script/spec to require 'rubygems':
require 'rubygems'

http://railized.com/2008/4/20/running-autotest-with-rspec-gem

If you encounter that issue, hope this helps you fix it!

No comments: