juretta.com

Rspec Rails plugin

December 07, 2006
Tags: Rails Rspec
I'm using the very convenient RSpec Rails plugin. From the Rspec website:
RSpec is a framework for practicing Behaviour Driven Development (BDD) in Ruby.

You can find more information on Rspec and the rails plugin on http://rspec.rubyforge.org/.

After using rspec for a little while the following error suddenly occured:

vendor/plugins/rspec/lib/spec/rails/version.rb:14: (RuntimeError) 
############################################################################
Your RSpec on Rails plugin is incompatible with your installed RSpec.

RSpec          : 0.7.4 (r1201)
RSpec on Rails : r35

Make sure your RSpec on Rails plugin is compatible with your RSpec gem.
See http://rspec.rubyforge.org/documentation/rails/install.html for details.
############################################################################

The RSpec plugin uses the Subversion Revision information to determine the current version number. If you are using Subversion to manage your rails project this error will occur if you have svn:keywords enabled and svn:keywords contains "Revision". The version information then reflects the revision of your repository.

You either have to disable svn:keywords for vendor/plugins/rspec/lib/spec/rails/version.rb or change the REV constant in version.rb to the current Rspec plugins Revision (1201 for the RSpec on Rails 0.7.4 plugin):

macbook-sts: $ cd vendor/plugins/rspec/lib/spec/rails
macbook-sts: $ svn pe svn:keywords version.rb
"Id Author Revision" -> "Id Author" (for example)
macbook-sts: $ svn diff -r44:45
Index: version.rb
===================================================================
--- version.rb  (revision 44)
+++ version.rb  (revision 45)
@@ -3,7 +3,7 @@
     module VERSION
       unless defined?(REV)
         # RANDOM_TOKEN: 0.644898830762263
-        REV = "$LastChangedRevision: 1201 $".match(/LastChangedRevision: (\d+)/)[1]
+        REV = "1201"
       end
     end
   end

About

This is the defunct blog of Stefan Saasen.